V/Oct control for Oscillator?

317 views
Skip to first unread message

Antonio Grazioli

unread,
Nov 21, 2017, 7:20:31 AM11/21/17
to Mozzi-users
I have built a VCO for my modulatr using an Arduino Nano clone
works well and respond to CV input voltage
The only issue I am having is trying to get perfect V/Octave control for the oscillator (in modulars usually 1 volt= 1 octave)

Does someone have previous experience with this ?

Tim Barrass

unread,
Nov 21, 2017, 6:30:30 PM11/21/17
to 'Ian C.' via Mozzi-users
Hi Antonio,

do you mean it's hard to drive accurate pitch calculations from the Arduino analog inputs because the resolution is 0-1023, and on a 5v system a fifth of that at 1V/octave is so rough?  There is a class in Mozzi called Oversample for increasing the resolution of analog readings, see examples>05.Control_Filters>Thermistor_Oversample.
Or is it something to do with instability of the ADC at different temperatures, or noise, or are you asking how to calculate the pitch?

Tim

--
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 email to mozzi...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mozzi-users/33819f2f-60c9-4d7b-a4dd-5738ca6b3c68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Antonio Grazioli

unread,
Nov 21, 2017, 8:49:07 PM11/21/17
to Mozzi-users
Hi TIm and thanks

I mean, "it's hard to drive accurate pitch calculations from the Arduino"..or at least I don't know exactly how to map the reading of an mozziAnalogRead (from 0 to 1023) to corresponding pitch to the Oscillators....
and basically yes, I need to calculate the pitch, I am not doing it correctly

Tim Barrass

unread,
Nov 22, 2017, 11:53:29 AM11/22/17
to 'Ian C.' via Mozzi-users
A basic way to start could be something like:

5v input range = 5 octaves = 72 midi notes = analog input values 0 to 1023

int n = mozziAnalogRead(pin);
float midival = (n/1023.f) * 72;
float midifreq = mtof(midival);

There's a chance that all the float calculations will be too slow...
one possible speedup, with some loss of accuracy, and only whole midi notes, without fractions, is:
int midival = ((long)n*(int)72)>>10; 
int midifreq = mtof(midival);

and this line:
int midival = ((long)n*(int)72)>>10; 

might possibly go a bit faster as:
int midival = ((long)n*(int)72)>>8; 
midival >>= 2;

You could get more precision with the Oversample class for the analog input,
together with some fixed point hell (using Q16n16 types for midi) for smooth fractional midi...
all quite do-able, but maybe get the simple version going first.

Tim

Antonio Grazioli

unread,
Nov 22, 2017, 2:29:04 PM11/22/17
to Mozzi-users
Thanks a lot. I will tets it ASAP!
Reply all
Reply to author
Forward
0 new messages