How to find the number of semitones between two frequencies?

1.4k Views Asked by At

Given two frequencies in HZ, how can I find the number of semitones between the notes they represent?

1

There are 1 best solutions below

1
On BEST ANSWER

Note that what human beings perceive as a difference in pitch is actually a ratio of frequencies: that is, if $\frac{f_1}{f_2}=\frac{f_3}{f_4}$, we will hear the same interval between $f_1$ and $f_2$ as we do between $f_3$ and $f_4$.

So, if $s$ is the pitch ratio that represents a semitone, and your two frequencies are $f_1$ and $f_2$, the answer to your question is the number $n$ that solves the equation

$$\frac{f_1}{f_2}=s^n \, .$$

You can find this $n$ explicitly in terms of $f_1$, $f_2$, and $s$ by taking logarithms:

\begin{eqnarray} \log \frac{f_1}{f_2}&=&\log(s^n)\\ \log \frac{f_1}{f_2}&=&n \log s \\ n &=& \frac{\log(f_1/f_2)}{\log s} \end{eqnarray}

Presumably you know $f_1$ and $f_2$. What about $s$? A semitone is one-twelfth of an octave, and an octave represents a ratio of $2:1$. So $s^{12}=2$: that is, $s=\sqrt[12]{2}$.