I'm trying to create a BPM object similar to the lfo/square object. The idea is to set the BPM, and steps (4th notes, 8th notes or 16th notes). The object looks like the screenshot below.
I found this table online that shows how bpm relates to milliseconds and Hz. http://www.wiseguysynth.com/larry/convert/bpm_table.htm
My problem with using a square lfo to create a sequencer is that it only outputs the square wave for 4th notes, and I want to be able to use 16th notes. I'm creating this object so I don't have to look up at which position I need to set the dial of the lfo to get the tempo I need.
I've figured out the necessary formulas to calculate the necessary Hz and milliseconds values, this is what I get for 120 bpm.
120 bpm = 2 Hz = 500 msec (4ths)
120 bpm = 4 Hz = 250 msec (8ths)
120 bpm = 8 Hz = 125 msec (16ths)
And this is the point where I'm stuck. The MTOFEXTENDED() function from the square lfo uses numbers generated by the dial to calculate the frequency. I've noticed that the numbers this function needs are quite large. For instance: If I feed the number 15938355 into MTOFEXTENDED(), I get the 8 Hz wave. I also know that the range of the dial is from -134217727 to 134217727.
Any ideas on how to convert from Hz to the range the dial uses?