wimvandenborre
New member
- Joined
- Mar 23, 2022
- Messages
- 3
Hey everyone,
I'm coding a program that converts incoming midi notes to an external synth, i have all the formulas for calculating midi notes to herzt (frequency of a note) but now I need to calculate this to an external synth which accepts tuning values from 0 to 255, see below.
I'm now trying to find how to calculate from midi notes to the 0 to 255 values or from first converting midi to frequency, then (insert formula ) from frequency to 0 to 255 values.
Any help would be appreciated.
So: value 0 = C1 = 32.70 hz. = midi note 24
value 127 = C2 = 65.41 hz. = midi note 36
value 255 = C3 = 130.81 hz = midi note 48
I have found that converting midi notes to hertz is this function:
So now I need to convert the incoming midi notes to the outgoing value 0 to 255.
I'm coding a program that converts incoming midi notes to an external synth, i have all the formulas for calculating midi notes to herzt (frequency of a note) but now I need to calculate this to an external synth which accepts tuning values from 0 to 255, see below.
I'm now trying to find how to calculate from midi notes to the 0 to 255 values or from first converting midi to frequency, then (insert formula ) from frequency to 0 to 255 values.
Any help would be appreciated.
So: value 0 = C1 = 32.70 hz. = midi note 24
value 127 = C2 = 65.41 hz. = midi note 36
value 255 = C3 = 130.81 hz = midi note 48
I have found that converting midi notes to hertz is this function:
1 2 3 4 5 6 | float noteToFreq(int note) { float a = 440; //frequency of A (coomon value is 440Hz) return (a / 32) * pow(2, ((note - 9) / 12.0)); } |
So now I need to convert the incoming midi notes to the outgoing value 0 to 255.