Frequencies and CV, converting back and forth in Lua (math math math)

Hey all, hoping someone out there has done the homework so I can copy it. :slight_smile:

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:

  1. get the input voltage from crow
  2. convert that input voltage to frequency
  3. do some math on the frequency (multiply by 3, for example)
  4. convert the mathed up frequency back to control voltage
  5. 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.

Thanks for any and all help and direction!

1 Like

ah heck yeah, music maths!

  • any MIDI note number divided by 12 is how the pitch is expressed in voltage (assuming volt per octave)
  • so voltage * 12 should get you the corresponding MIDI note on any measured voltage
  • MIDI to Hz from the norns docs:
(440 / 32) * (2 ^ ((note_value - 9) / 12))

so in total, i’d start with this pair:

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!

does that get you closer?


Gold! :slight_smile: Now for 20 characters…


what if in microtonal territory? i.e 60hz to Volts

oh great, please let me know when you are ready!

Isn’t there a way to do this with crow already or am I mistaken ?

In crow reference :

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:


Dan’s post here still works for microtonal! It just converts Volts to Hz, it does not quantize and has no idea what “scales” are