#### From logarithms to cents

In the previous section we almost arrived at Ellis's formula for calculating cents. Here we will follow the process in more detail and arrive at the final formula.

Let's find the base 2 logarithms of the frequencies of two notes (C4 and C5) separated by one octave:

Note Frequency Logarithm base 2 Power
C4 260 Hz. log2 (260) = 8.022367813028454 28.022367813028454 = 260
C5 520 Hz. log2 (520) = 9.022367813028454 29.022367813028454 = 520

#### How do we calculate logarithms base 2?

Your calculator probably does not have the ability to calculate base 2 logarithms. Programs like Excel, Numbers or Google Sheets can do this with the following formula:

=log(value, base)

where value is the number you want to take the logarithm of and base is the base you want to use (2 in our case).

Or you can use our calculator:

Subtracting the base 2 logarithmic numbers of the frequencies of C4 and C5 gives:

9.022367813028454 - 8.022367813028454 = 1

The difference between the base 2 logarithms of the frequencies of the notes of an octave is 1 (if it were two octaves, the result would be 2). Ellis proposes multiplying this number by 1200 to get the cents. Why 1200? Because the octave is divided into 12 tones and 1200 assigns 100 cents to each semitone.

We need to multiply by 1200 in our formula:

$cents = (log_2(f_2) - log_2(f_1)) * 1200$

Note: You must subtract the logarithms first and then multiply by 1200.