Skip to content
Rob Stave edited this page May 1, 2023 · 3 revisions

VCO Notes

Anytime I have something down as a VCO, it means that there is some relationship between the analog value on a pin and a frequency going out.

The relationship is not always the nice Volt/Octave standard. For Drones and general noise makers, this is not always a requirement not noticeable. But if you want to incorporate this in a melodic way to something like a Eurorack modular ( or anything with a CV voltage), thats what you want.

The VCO strategies I have can be broken down to the following.

Counter based

These are for used in the simple sketches. Basically I have an interrupt running at a pretty high frequency and they are checking counters that are decremented to flip a bit at zero. In this case...you have some pretty high resolution with big counter numbers, and low resolution when the counters are small. What this means is it might only span an octave from 0-2 then the next octave is 3.5 volts and the next at 4.75. Great for bass notes...and chiptunish at high freqs.

You can offset this with multiple map functions to make a pseudo exponential curve. Again...for drones this is fine

Bonus...with counters, you can just do simple math to get free wacky sounds. Just play the last bit. This is a little like bytebeat in a way.

DDS ( V/Hz)

In this case, we are doing direct digital Synthesis. This is nice because it will spread out the notes a little better and gives good resolution at higher frequencies. You can do things like ramps and sawtooth with just bitwise operations or you can map the uppermost bits to a wavetable.

http://www.technoblogy.com/show?QVN is going to be a good place to dig deeper on that.

The nice thing about DDS is you can do vibrato to FM by tweaking your offset over time as well.

Volts per hertz just means that the relationship is linear. In DDS, offsets to freq might end up like

1 Volt 200 hz
2 Volt 400 hz
3 Volt 600 hz

It will not sound right if your pushing a CV from a sequencer

Volt/Octave

This is the best for modular setups. Its just not easy to do in Attiny. Its not hard, just more steps. So the easiest way to do this is with a lookup table.

I have used 512 values that map 0 -> 5 to the proper offsets. See https://github.com/robstave/ArduinoComponentSketches/blob/master/ACS-85%20ATTiny85%20sketches/ACS-85-0125/ACS-85-0125.ino

This requires a little setup. You might be able to write to pgm memory, but its easier to do it elsewhere. I used a spreadsheet with

// =125*(2^(A1*5/512)) // You can do this in a spreadsheet and then copy/paste to note pad and replace \r with , and \n with "" // There is room in memory for 1024...but i dont think it will make a lotta difference

125 was a somewhat arbitrary number you can tweak that this just maps 0 volts to an offset of 125 ticks and so on. you can go back and forth until you find a starting value you like. The internal clock on ATTNIY is all over the place, so this will not be the same if you write this sketch to identical chips.