Polyphony and volume in Mozzi

1,004 views
Skip to first unread message

GuitarExtended

unread,
May 21, 2013, 9:07:49 AM5/21/13
to mozzi...@googlegroups.com
Hi, I'm new to Mozzi and to this forum. I'd like to thank the developer first of all for making what I think is one of the most exciting libraries for Arduino.
I've quite a lot of DSP in Pure Data, but I don't understand everything in Mozzi yet. In particular, I'd like to know :

- How to handle polyphony. Right now I have 12 oscillators in the audio loop, each of them being multiplied by a gain (0 or 1) to turn it on and off. I need this because i'm building a small keyboard, and I can't think of any better way to do this. Is there a more efficient way to handle this ? In particular, how can I apply an effect to the sum (for instance using phMod for the vibrato effect, or the reverb) ?

-  How does one control the volume ? The bit shifting thing is a bit obscure to me, and I can hear some artifacts when I try the ADSR (in the release phase). Is there a way to normalize the output ?

On a side note, has anyone successfully used capacitive sensing with Mozzi ? I am currently using this (http://playground.arduino.cc/Code/CapacitiveSensor) but it's not sensitive enough and I find it practically impossible to debounce the inputs correctly. I've also tried this (http://playground.arduino.cc//Main/CapacitiveSensor?from=Main.CapSense) but the example patches won't compile (that's another story...).
Cheers,
Pierre.

Mr Sensorium

unread,
May 22, 2013, 10:08:58 AM5/22/13
to mozzi...@googlegroups.com
Hi Pierre,

There's Examples>Mozzi>basics>Control_Gain for an example of volume control.

For bitshifting, the Arduino reference is a good place to start:
file:///Applications/Arduino.app/Contents/Resources/Java/reference/Bitshift.html
It's really useful to work with a programmer's calculator which displays the binary representation along with decimal to figure out shifts and to choose efficient number sizes.

12 oscillators is pretty ambitious but I just tried it and it worked as long as all they were doing was being summed... about 1/2 that many is more realistic if you're multiplying for gain or using adsr on each voice.  I don't know of a more efficient way to change the volume than multiplying, though it would be great if anyone can suggest one!
I tried using 64 wavetables of different volume levels and switching between them - it was too coarse and resulted in clicks on transitions.  I haven't had time to check adsr but one hint is to try different release times - if the step size of the envelope's transition each audio tick is too small, it might truncate to 0 and do nothing, or if it's big it might be zippery... if you send your code it would help.

Attached is a sketch with 10 oscils summed and processed through a delay... just make sure your summed signal is scaled to fit into the input range of any processing as per the documentation for each object.  phMod works on an oscil by changing the rate of playback of it's wavetable, it won't work on an already rendered signal.  If you want vibrato, try it with a delay - you'll probably want to smooth or interpolate the changing delay_cells parameter at audio rate if you change the delay time quickly, as for vibrato.  Have a look at Examples>Mozzi>control_filters>Line_vs_Smooth.

I haven't tried capacitive sensing, but Mozzi has an object called RCpoll http://sensorium.github.io/Mozzi/doc/html/class_r_cpoll.html which I suspect would be suitable.

Bit rushed at the moment, hope that helps..
tim
Sinewave_Many_HIFI_flange.zip

Pierre Massat

unread,
May 24, 2013, 6:21:07 AM5/24/13
to mozzi...@googlegroups.com
Hi Tim,
Thank you for your reply. I'll try your sketch this week-end. I think i'll to do some dynamic note allocation to a limited number of oscillators instead of having 12 of them running all the time.
For your information I tried the CapacitiveSensor library (http://playground.arduino.cc//Main/CapacitiveSensor?from=Main.CapSense) in a Mozzi patch and it worked without conflicts.
Cheers,
Pierre.


2013/5/22 Mr Sensorium <barra...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "Mozzi-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mozzi-users...@googlegroups.com.
To post to this group, send an email to mozzi...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mozzi-users/1a797b91-a232-441d-a170-cb4d21a25c12%40googlegroups.com?hl=en-GB.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages