# Pure Data: Finding the Frequency of an Interval Using Cents

In creating a microtonal scale system in Pure Data, I decided that the easiest way to "input" a new scale was to simply input the cents for each ratio, then apply that to a starting frequency, considering the starting frequency as the first octave. By doubling, tripling or halving the starting frequency, one arrives at octaves of the microtonal scale. You'll see that this system works to input any scale, microtonal or not.

This system works on the principle that since we know the starting frequency (440 Hz in this case), and we know the cents above root of the desired interval, we can find the frequency of the desired new interval by using the following formula: In this formula, b is the frequency of the new interval (which we don't yet know).
a is the starting frequency (440 Hz in this case)
n is the cents of the new interval (lets start with 1200 cents, the octave, to test out our math) The answer is, of course, 880 Hz, or 440 Hz x 2 to the first power, as shown in the following patch: Let's do a more challenging example, applying the change of 100 cents to the starting frequency: This can be thought of as: In the Pure Data sketch, I've used the [pow] object to do the exponent math.

As you can see in the following patch, we've arrived at the correct answer of 466.164 Hz, or A sharp. You can see more advanced usage of this system in my post about Harry Partch's 43-Tone scale, in which I've created his scale using the above method. In the future, I'll detail how to output microtones with MIDI + Pitchbend.

### Glossary

Cent
The Cent is a logarithmic unit of measure for musical intervals (see Wikipedia for a more in-depth description). If you've experience with playing or tuning musical instruments, you may have heard the term, "a few cents flat", or, "you're a few cents sharp" before, meaning that you are playing a slightly higher or lower frequency than the intended note. Essentially, a cent is the ratio between two close frequencies. The standard western chromatic scale is considered an evenly tempered scale because the "distance" between each semitone is 100 cents. In all tuning systems, an octave is 1200 cents, or twice the frequency of its base note.

Hertz (Hz)
The hertz is an international unit of frequency, defined as the number of cycles per second of a periodic phenomenon. With sound and music, this means the number cycles per second a sound wave makes. The note A above middle C, for example, oscillates at 440 hertz, or 440 wave cycles per second.  The next A, an octave up, cycles at 880 Hz.

Equal Temperament
A tuning system where the distance between every interval is equal. In the standard western 12-tone equal temperament tuning, each note is 100 cents apart.

Microtonal Scale
A tuning system where the distance between intervals is not limited to equal spacing. Microtonal scales can express notes and relationships not found in the standard western system of 12 equally-spaced intervals.