Semitone to Tick Iteration Speed

dsp

#1

Hey All,

I’m not sure how to phrase this question so i’ll just give an example.

We all know if you want to change the pitch of a signal, you can iterate through it’s buffer at a different speed than the sampling rate, effectively resampling the signal, to make it’s pitch change.

If you wanted to increase the pitch by 12 semitone up, you’d iterate through the buffer by +2 samples per tick. And if you wanted to play back normal speed, +1 samples per tick. Octave down? 0.5 samples per tick.

Is there an equation that returns this value, for example, if you passed in 0, it would return 1, if you passed in 12, it would return +2, -12 would return 0.5, and +3 would return the float value you should move per tick to change the signal three semitone up.

I know this function exists but i’m not sure what it’s called or what to search for it 0.o

Thank you for any responses !

J


#2

pow(2.0, semitones/12.0)


#3

Nice!

Work’s perfectly. I’ll take some time and plug some values into this function to understand how it fits the curve.

Thank you Jussi!

Best,

J


#4

Hint: the playback speed factor (1 for same speed, 2 for double speed) directly multiplies all frequencies in your signal. So a 440Hz sinusoid will have it’s frequency changed to 660Hz with a speed factor of 1.5.
Another hint: https://en.wikipedia.org/wiki/Equal_temperament


#5

Ahhh derp,

The mental model for this one was definitely off on this one, and a bit of rusty math.

popping it in grapher quick helps:

It’s easier to think about it in terms of the frequency spectrum as opposed to the scrubbing speed xP thanks Daniel!