What is the equation for figuring out the change in pitch from changes in tempo?

3.8k Views Asked by At

I have various audio loops that need to change pitch when I change the tempo. The relationship is not linear, so it must be exponential, but I don't know what the equation would be.

There is an online calculator that does individual changes, but I need to have it automatically change the pitch when I change the Beats Per Minute.

For instance:

If I gradually go from 123 beats per minute (tempo) down to 112 BPM, the overall pitch change is -1.62.

From 85 BPM to 111 BPM, the pitch change is 4.62

And from 176 BPM TO 137 BPM, the pitch change is -4.34

From these examples, is it possible to find exponent?

2

There are 2 best solutions below

0
On

The formula is $$ pitchchange=-12\log_2(tempo_1/tempo_2) $$ where $tempo_1$ denotes the tempo before the change and $tempo_2$ the tempo after the change.


The theory behind this is that when the frequency of a tone is doubled, the pitch changes 12 chromatic steps (also known as one octave), so we have the (exponential) relationship $$ y=2^{x/12} $$ where $y$ denotes the frequency and $x$ denotes the number of chromatic steps. Dividing two known frequencies $y_1$ and $y_2$ and then solving for the pitch change $k$ from $x_1$ to $x_1+k$ then yields: $$ y_2/y_1=\frac{2^{(x_1+k)/12}}{2^{x_1/12}}\\ \iff\\ y_2/y_1=2^{k/12}\\ \iff\\ k=12\log_2(y_2/y_1)=-12\log(y_1/y_2) $$ and scaling the tempo of an audio sample by a factor corresponds to scaling all its frequencies by that factor, which is why the same principle applies to ratios of tempos.


BONUS: To calculate $\log_2(x)$ you can use any logarithm $\log$ and calculate $\log_2(x)=\log(x)/\log(2)$.

0
On

If tempo $T$ in b.p.m. is an exponential function of pitch $P$ in whatever units you're using, then $P$ is a logarithmic function of $T$, and by definition we have $$P(T) = P_0 + A \log_2 T,$$ where $P_0$ is the pitch at $1$ b.p.m. and $A$ is some constant with the same units as pitch. Since we only have measurements of pitch change, we may as well subtract: $$\Delta P := P(T_2) - P(T_1) = A \log_2 \frac{T_2}{T_1}.$$

Substituting the tempo change from $123$ to $112$ b.p.m. (a change of $-11$ b.p.m.) and the resulting pitch change of $-1.62$ gives $$(-1.62) = A \log_2 \frac{(112)}{(123)},$$ and solving gives $$A \approx 12.0;$$ the other given values give similar values for $A$. (In fact, if the units of pitch are steps in the chromatic scale, $A = 12$ is an exact value, so that a doubling of tempo corresponds to an increase of $1$ octave, or $12$ steps.)

So, the formula for the resulting pitch change $\Delta P$ from a tempo change from $T_1$ to $T_2$ is $$\color{#bf0000}{\boxed{\Delta P = 12 \log_2 \dfrac{T_2}{T_1}}}.$$