I understand this is the result, but what’s the science behind it? Why would deriving two to the power of ‘semi tone difference over semi tones in octave’ result in the desired pitch step for the render function?
When I feed values into a calculator I see it works out
e.g. root midi c2, current midi b1
2^(-1/12) = 0.94387431268
e.g. root midi c2, current midi c#2
2^(1/12) = 1.05946309436
This produces scalar, much like targetSamplerate/sourceSampleRate will produce a scalar. I just can’t visualise why it works.
I suppose 2^1 is two, that’s the same as root midi c2 target c3, and 2^0 is 1, that’s the same as root midi c2 and target c2 also. So I suppose it works out simply as a y= 2^x produces desired values.
a cool thing you can do with this formular, which also improves your understanding about it, is to exchange the “12.0” with an integer (non-integer are fine too but then there are no octaves) variable. call it xen. now you can convert midi notes to xenharmonic scales easily in your synth (or what it is that takes midi notes), because the 12 stands for amount of notes per octave