Hey all, hoping someone out there has done the homework so I can copy it.
I’d like to take a CV reading on a crow input and do some math on the frequency in hz that CV represents, then pump the result out of the crow outputs.
I’m hoping there’s an equation somewhere describing the relationship between cv and the frequency in hz that is already solved for cv and for frequency.
I searched around on the internet and found something that might be close:
freq = 55.0*2^(cv+.25)
When I tried to use it in my Lua script (and learned about math.log(n) along the way) the results weren’t what I was expecting. So I’m not sure if the equation is wrong (or more likely my solving for cv).
My hope is to do the following:
get the input voltage from crow
convert that input voltage to frequency
do some math on the frequency (multiply by 3, for example)
convert the mathed up frequency back to control voltage
send that control voltage on a crow output
What I could use a hand with (or pointer to something to read etc) is the equation that describes how CV maps to frequency.
local volt_to_midi = incoming_volt * 12 -- you can do other transformations around this, if you want
local midi_to_hz = (440 / 32) * (2 ^ ((volt_to_midi - 9) / 12)) -- you can redefine for A by changing 440!
hztovolts(freq [, reference]) – convert a frequency to a voltage
– default reference is middle-C == 0V
– (optional) reference is the frequency that will be referenced as 0V
Here’s the documentation of how I do it in Timbre of Starlight. A bit more involved than hztovolts and I honestly can’t remember why I did it from scratch. But either way, more detail than anyone could ever want on the subject haha: