Arduino based VCOs?

Have any of you geniuses/lunatics built a VCO from an Arduino?

I’m currently working on an 8-bit wavetable VCO on an arduino and i’m curious how I should handle the CV input into the arduino. After some googling around i’ve seen some similar forum posts with quite a lot of variety in methods on how to deal with CV input and I’m unsure of the direction to take.

It seems a lot of problem focus around the fact that CV could be -5v to +10v, but at the same time I’m thinking, since I’m building my Kosmo system from my own modules, i could make sure that I keep CV within the 0v-5v range and not bother with this? For example, i’m planning on using the Korg SQ1 as a sequencer which I believe only does 0v-5v.

The other part I’m not sure about is how to properly scale the 0-5v input to the correct frequencies for the oscillator to produce the correct notes.

Thanks!
Jon.

5 Likes

For those who are interested, here is the arduino code: GitHub - jonphilpott/feztable: Arduino based 8bit wave-table oscillator.

as you can see it’s pretty simple, I wanted to keep it as simple as possible so it’s easy to modify. Currently it’s only using one wavetable since I havent quite figured out how I want to control mixing between different wavetables.

3 Likes

I’d say have a look at some mutable instruments schematics, there’s a lot of examples of MCU CV I/O circuits.

And agreed, the CV standards are a bit messed up…

We talked a bit about this here: Arduino CV inputs / offsets

I think some kind of protection would be good to have and it’s not much stuff to add :wink:

1 Like

You could, but be aware that’s a big self limitation: It prohibits you from ever using a design from someone else that goes outside that range, and it limits you to a 5 octave pitch range. Yeah, you can do a lot in 5 octaves. But with just an op amp you can rescale and offset (or with just a voltage divider you can rescale) a larger CV range to 0 to 5 V and not have that limitation.

Edit to add: There is a downside, which is that you have a 10 bit ADC and with a 0–5 V input an LSB is 4.88 mV corresponding to 5.85 cents pitch. If you rescale a ±5 V CV to 0–5 V and digitize that then an LSB is 11.7 cents, nearly an eighth of a semitone. That’s… not very good pitch resolution. Even 5.85 cents (and that’s in the ideal case, with no ADC nonlinearity) isn’t that great. An external 12 (or more) bit ADC would give better results.

For that you might look at this:

which is a DCO, not a wavetable, but maybe the CV scaling could be done similarly. Edit to add: You notice that uses a 16 bit ADC and takes 0–10 V input.

2 Likes

great stuff, thanks all!

oh yes, I would love to be able to build a 1v/oct oscillator with the arduino! as I have dozens of arduino’s it would be nice to add a digital oscillator to my modular!

1 Like

Any idea how electricdruid solved this problem of resolution with the PIC based VCO?

Another solution is to look at what the fellows over at AE Modular are doing. The AE Modular format is 0 to 5V and fits perfectly with Arduino and Teensy.

In fact there is already a 0-5V Wavetable oscillator in that format: WAVETABLES, not to mention GRAINS and FMOS.

That’s where I am. Do I stick with a 0-5V system and make it perfectly match my AE Modular, or do I go totally analog +/- 12V or +/- 15 system and never the twain shall meet?

By combining multiple CVs. The main NOTE CV is 0−5 V quantized to MIDI notes 0-63, it then adds in three other signals.

3 Likes

This is pretty interesting, will look at this further!

1 Like

Exactly, thats sort of my thinking right now, I’ve built one Kosmo case, and i have a good about where I want to go with it, so I’m almost thinking that 0-5v may not be a big problem for me, especially since i’m definitely more of a software guy…

1 Like

Maybe that’s the road I need to take: Build a two row kosmo, then go digital or hybrid.

1 Like

I made a Mozzi based module for my mini-kosmo. Mozzi has some built in translations to take a midi key number and convert it to the right frequency (which in my mind was the hard part).

Here is the panel - the actual arduino based synth is just the right side. The left side is actually a 3340 based VCO that I am still fiddling with and so haven’t labeled yet.

I wrote a simple thing that reads an analog pin on the arduino and converts it to a midi key number. Then pass it to the mozzi function mtof() to convert that into a frequency. Here is the code I wrote. updateControl() is a Mozzi thing.

But I think you could import the mozzi library, use its functions and this code and it will generally work for whatever you want without using the actual Mozzi sounds or control functions.

// define the CV input pin as A0, Tremelo as A1, Wave select as A2
const char CV_in_port = 0;

void updateControl(){

  // read CV frequency 
  int CV_value = mozziAnalogRead(CV_in_port); 
  
// .... other stuff to choose a waveform called current_waveform

  // Convert CV to a midi note between 21 and 117 which is Moog 1V/Oct as per midimuso documentation
  int low_to_high = (117 - 21);
  float midival =  (CV_value / 1023.f) * low_to_high; 
  midival = midival + 21;

  // Convert midinote to a frequency using mtof function from mozzi
  float midifreq = mtof(midival);

  current_waveform.setFreq(midifreq);
2 Likes

wow! that’s cool. How did you handle the CV input electronically?

I have the CV voltage coming out to one of the analog in pins on the Arduino - in this case pin 0. So I have a voltage coming in between 0 and 5 V from a controller or a Midi-to-cv module.

I could just use a native read on that pin using arduino code.

I happened to use the mozziAnalogRead() function, but to be honest, I don’t know what does more than the native analog read.

But it all works well!

So nothing between the CV input jack and the arduino? wow!

1 Like