Tuning is impossible – an interactive.

Table of Contents
  1. Motivation
  2. Prerequisites
  3. Basics of sound
  4. Harmony
  5. How we came up with the number twelve
  6. Alternatives and solutions
  7. Conclusion
  8. Addendum
  9. References


I want to talk about something I've had in my head for a while now, and that partially inspired me to create this blog. Something embedded in every melody, but complex in its own right and something I had implicitly taken for granted my entire life: Tuning systems. But before I can start my monologue on the topic, we'll need to get some things clear, specifically, how sounds work, and why some sounds are more harmonious than others.

This will get somewhat long, since I'll be trying to be as clear as possible, but bear with me and you'll start hearing music in a completely different manner.


Basic music theory knowledge, specially chords. And algebra, up to logarithms.

Basics of sound

Sound is most often defined as a sort of wave that propagates through air. Although this definition isn't wrong, it doesn't quite grasp the complete picture. So for the sake of precision, it's useful to know that what our ears are actually detecting is the variation in air pressure, which is why certain actions like clapping or turning on a fan or moving something forwards and backwards at high speeds produce audible sound. The greater these changes are, the louder the sound will be. (Note that these changes in pressure have to be quite fast so we can percieve them, more on that shortly.)

The simplest type of sound is known as the sine wave, named after the shape it forms when plotted against a time axis. (You've probably seen it before if you ever took trigonometry.) To create a sine wave, one must make air pressure oscillate between two values in a sinusoidal manner. A graphical illustration helps make this easier to understand. (Remember to turn down your volume, headphones strongly recommended!)

250Hz Sine Wave
Fig. 1 – A sine wave: The y-axis represents variation in pressure, the x-axis represents time in seconds. (Click on the image to play sound).

Could you hear it? What? You're telling me you couldn't? Did you disable Javascript or try an outdated browser? Well, I'll continue as if normal, now that you'll know what you're missing.

As we can see, this particular sine wave repeats itself every 4ms, and therefore oscillates 250 times in a second. To represent this fact, we simply state that the sine wave's frequency is 250 Hertz, abbreviated as 250 Hz, which turns out to correspond to a slightly sharp B3. (We'll get to converting frequencies to notes a bit later). Something repeating itself 250 times per second might seem quite fast, but we have no problem detecting higher tones (you probably percieved this one as being in the mid-range). In fact, the average human ear can hear frequencies anywhere from 20 Hz to 20000 Hz (although we do have more difficulty at the extremes).1

Our ears can also detect various frequencies played one on top of the other. This shouldn't come up as much of a surprise, since this is what all sounds in nature are, almost. For it turns out that in short time lapses, every sound wave approximates very closely a sum of sine waves, each with a different frequency, which is why when we hear a song, we hear many frequencies at each instant. (This is the consequence of what is known as Fourier analysis, but this is beyond the scope of this post). A simpler example of the aforementioned phenomenon is given by the following picture, which represents a 500 Hz sine wave on top of a 1000 Hz sine wave.

500 Hz Sine Wave + 1000 Hz Sine Wave
Fig. 2 – Two sine waves on top of each other, one with double the other's frequency. (Click on the image to play sound).

This may sound a bit gritty, since we're playing pure tones, but it's very harmonious nevertheless. We may now start to wonder: What frequencies sound "nice" when played together? And trying to answer this can lead us to some very interesting concepts, which we'll now investigate ourselves.


It turns out that the way we percieve our music doesn't depend that much on the actual frequencies, but instead, on the ratios between them. This section will cover on the topic.

To start off, let's try an experiment. I'll show two different waveforms, and I want you to guess, before hearing any of them, which will sound more harmonious. Ready?

Which is more harmonious?
Mystery Wave
Waveform #1. (Click on the image to select it).
Mystery Wave
Waveform #2. (Click on the image to select it).

If you guessed incorrectly but still believe you're right, you have a very skewed sense of harmony. Let's try one last one.

Which is more harmonious?
Mystery Wave
Waveform #1. (Click on the image to select it).
Mystery Wave
Waveform #2. (Click on the image to select it).

How did you do this time?

You may have noticed that the more harmonious sounds seem to repeat their pattern over time, while the more discordant ones look much more chaotic – almost as if the brain had a preference for periodicity. In fact, the first pair of waves' waveform #1 was a perfect fifth (specifically, a 500 Hz tone combined with a 750 Hz tone), and the second pair of waves' waveform #2 was a perfect fourth (specifically, a 500 Hz tone combined with a 666⅔ Hz tone), both two very important chords in music. Since the sum of two sine waves is periodic iff their frequencies are at an integral ratio, we can form our first hypothesis as to what constitutes harmony.

Hypothesis #1
Two tones sound harmonious together iff their frequencies are at an integral ratio.

This may look pretty convincing at first, and we have a lot of evidence backing it up: Our piano's perfect fifth is almost at a 3:2 ratio, its perfect fourth approximates 4:3, a major triad resembles 4:5:6... wait.

It turns out that if you play a perfect fifth on a piano, you won't actually get a 3:2 ratio, you'll get something closer to 2.99661:2. A perfect fourth is closer to a 4.00452:3. And a major triad? It's more of a 4:5.03968:5.99322. (We'll see why this is the case in just a moment).

But still, these differences are almost imperceptible, since the intervals (ratios or differences between notes) are close enough to perfect. In fact, here are two major chords, one perfect, and one "piano-like". See if you can detect the difference.

Which is the "real" perfect fifth?
Mystery Wave
Waveform #1 (Click on the image to play sound).
Mystery Wave
Waveform #2 (Click on the image to play sound).

If you answered correctly, you probably guessed: The smallest difference in tones humans can distinguish is about two or three times bigger than the one presented.2 Or maybe you looked at the pictures. Or maybe you detected the slight beating effect. Or maybe you do have superhuman hearing. Let's continue.

So, after this, it only makes sense to update our hypothesis. We'll do it as follows.

Hypothesis #2
Two tones sound harmonious together iff they their frequencies are "close enough" to being at an integral ratio.

Let's reevaluate the hypothesis again, by means of evidence. Right now, we have a pretty strong argument for it: The strongest harmonies on a piano are all very well approximated by integral ratios. To see why, we'll try some other ratios to see what we can find. For the sake of order, we'll arrange them by denominator (in lowest common terms), limiting ourselves to ratios greater or equal to 1 (1:2 is the same as 2:1) and smaller or equal to 2 (so as to not span multiple octaves, for the sake of relative brevity).

Interval Name Play
1:1 Unison
2:1 Octave
3:2 Perfect fifth
4:3 Perfect fourth
5:3 Major sixth
5:4 Major third
7:4 Harmonic seventh*
6:5 Minor third
7:5 Septimal tritone
8:5 Minor sixth
9:5 Minor seventh
7:6 Septimal minor third*
11:6 Undecimal neutral seventh*
*This interval does not have any good approximation on the piano.

We can notice some things right off the bat. First, the farther down we go, the harsher our chords seem (roughly). And also, between intervals of the same denominator, the ones with the higher numerator seems to sound worse – almost as if we had a hardwired preference for simple fractions. In fact, let's do one last test: I'll play an interval with a high numerator and denominator, and you'll tell me if you like it.

64/37 interval
Fig. 3 – A 64:37 interval. (Click on the image to play sound).

I don't know about you, but for me, this settles it completely. We'll summarize all of our findings in our last hypothesis.

Hypothesis #3
Two tones sound harmonious together iff they their frequencies are "close enough" to being at an integral ratio with small numerator and denominator.

How we came up with the number twelve

After our last section, we can now tackle a very interesting question: Why do we have twelve notes on an octave? Why not 13, or 1000?

As for most findings, there's a perfectly reasonable but complicated historical motive. To expand upon this would take me another whole blog post (although a quick and precise exposition can be found here), so instead, let's continue taking a modern viewpoint as we have done previously.

One of the reasons we can use the same twelve tones without all pieces of music sounding roughly equal is because it gives us our capability to transpose songs. For example, you can take the melody of "Twinkle Twinkle Little Star" (C, G, A, G, F, E, D, C), move every note, say, five half-steps up (F, C, D, C, B♭, A, G, F) and get a melody that feels exactly the same way as the previous one. This works because our interpretation of music depends little on the actual frequencies employed, relying instead only on the ratios between notes. (You didn't even notice none of the notes on any previous audio were even on a conventionally tuned piano, did you?) And the reason we can preserve ratios when shifting notes up or down an equal amount is because the ratios between notes are all equal.

To convince yourself that the property of transposing is useful, just think of what would happen on a system without it. First of all, playing on different scales might sound completely different – not that bad when you think of it, but this is quite inconvenient if you want to preserve the feel of a song while changing the notes themselves. Also, it'd be pretty weird if a perfect fifth starting on C, for example, was completely different to one starting on C#: Our current theory of chords would pretty much collapse under itself. (Are you not convinced all of this is bad? Wait a moment and you'll find out you may just be right.)

The problem with transposing is that it comes at a very heavy price: Most intervals need to be made irrational! Precisely, if we divide the octave (arguably the most important interval, which we should therefore preserve) into n different, equally-spaced notes, two consecutive notes will have the ratio 1:n2 .

This only begs the question: Why do our twelve notes work so well, above any other equal division? The answer may come at a surprise.

They don't.

I'll clarify what I mean by this, but first, I have to define what it means to take the distance (or difference) between two notes, so as to be able to compare different tunings of the "same" interval. Clearly, whatever definition we use, we should have it so that an interval represents the same distance, whatever the frequencies employed are. Since intervals are really just ratios, it follows a logarithmic system is natural for what we're doing, and by fixing the distance between two notes an octave apart to be equal to 1, we get the following:

Definition of distance
We define the distance between two notes at frequencies a and b to be equal to log2(a)-log2(b).
We measure this distance in octaves (O).

Something else is important. I mentioned above that the difference between a perfect fifth and the perfect fifth on a piano (1227) was about two to three times smaller than the smallest difference humans can perceive. Turns out, this difference is about four thousandths of an octave wide, or in other words, with a size of 4 millioctaves (mO) (although rest assured, I could barely differentiate intervals two times bigger when I tested myself). So, you should take the 4 mO limit as a bare minimum. (A more common unit is the cent, equal to one twelve-hundredth of an octave or to 5⁄6 mO, but I'll avoid it since it biases towards our current twelve note system, you'll see why soon.)

Now, we can continue, with this in mind. I have below our twelve-tone system tuned with C = 250 Hz (instead of the usual C ≈ 261.62557 Hz, as to parallel the intervals that have been previously played). Small integer intervals that closely approximate each note (in relation to the root) are also shown (the choice is a bit arbitrary, but I tried to make them as small as I could while preserving accuracy), as well the difference between the notes to these ratios, in millioctaves. Take a close hear and see what you can find.

Note name Ratio to root note Decimal approximation Representation as ratio (with C) Play notes
C 1 1 1:1
C# 122  1.05946 18:17 (+0.87 mO)
D 62  1.12246 9:8 (-3.26 mO)
D# 42  1.18921 6:5 (-13.03 mO)
E 32  1.25992 5:4 (+11.41 mO)
F 1225 1.33484 4:3 (+1.63 mO)
F# 2 1.41421 7:5 (+14.53 mO)
G 1227 1.49831 3:2 (-1.63 mO)
G# 322 1.58740 8:5 (-11.41 mO)
A 423 1.68179 5:3 (+13.03 mO)
A# 625 1.78180 9:5 (-14.66 mO)
B 12211 1.88775 17:9 (-0.87 mO)
C' 2 2 2:1

There are many things to point out. Let's start with some to get them out of the way. First of all, the differences in millioctaves between some intervals and their approximations as ratios are equal. This is because, as can be easily seen, a ratio can be just as well approximated as its inversion (where the inversion of the interval a:b is the interval 2b:a). So in reality, it's just an artifact of the fractions I chose.

Another thing: The C:C# ratio sounds as if it was humming. This is because of an effect called beating (I had already mentioned it a while ago) that occurs when two close notes are played together. This wouldn't be quite as noticeable if we played it with real instruments (which have lots of other tones), so be wary of that.

Now, as for the interesting stuff. Note that some of the ratios are quite off from where they should be, and other very simple ones are missing! For example, the major third and minor third could use some improving, and the 7:5 ratio is very misrepresented. Also, ratios involving primes such as 7 and 11 are completely missing.

The one thing at which our twelve note system excels is at approximating the perfect fifth (and the perfect fourth, therefore). This is because 712 is a continued fraction convergent for log2(32), which basically means 712 is a number x for which 2x32 holds better than for any other fraction with a smaller denominator. The fact that the other fractions can be represented as they are can be thought of as a coincidence.

You may be thinking that this system is not so bad, but there are many benefits one can get out of alternate tuning systems. Here's an incomplete list.

  • Purer harmony, resulting in:
    • A generally cleaner sound, most noticeable when playing chords with many notes.
    • A reduced beating effect when playing pure tones.
    • The resulting sound remaining cleaner after FX. (Van Halen, for example, slightly detuned one of his guitar strings so as to be able to play major thirds in his electric guitar.)3
  • New chords, not to be found in our current system.
  • More liberty over the general feel of a song.
  • A much greater ability to experiment.

Since these areas are virtually uncharted, there's really only one question: Why not?

Alternatives and solutions

People throughout the years have developed diverse tuning systems, and some just turn out to work better than others. Our twelve tone equal division of the octave (or 12-EDO, for short) is one of them, but that doesn't mean we can't improve from that. We'll present three methods that have been used, while encouraging you to try any other you think might work.

Ditch the number twelve

A very natural alternative would be to simply try numbers other than twelve. Our options are literally unlimited, so where do we start our search? The answer to that question depends on what you want to achieve. We'll limit ourselves to systems with fifty notes or less, so as to not go way out of reach – otherwise you could just grab every single note.

Say for example, that you want to be able to build upon chords using the underrepresented 7:4 ratio. You could look for the systems that best approximated it, and then use the one you found most convenient (because of the membership of other intervals, etc.). To do this, you can try the below calculator.

Find EDO for interval
Ratio: : Max EDO:
Limit (mO):

Of course, we could also go for a system that's better overall, even if the intervals it contains aren't that well approximated. One good way of doing this is by seeing how well the system approximates prime number intervals such as 3:1, 5:1, 7:1, …, remembering that if an EDO contains two intervals a and b, it must also contain am:bn for every pair of integers (m, n), and that if the intervals in question are well approximated, expressions resulting from their product or division should also be roughly approximated.

The following calculator can also help with this. It looks for the values of x for which the sum of the amount a prime p deviates from its closest x-EDO approximation, divided by ps for some s (so that by choosing an s greater than one, one gives more weight to smaller primes, and by choosing s < 1, the opposite effect is achieved), taken from p = 2 up to a specified limit, is smaller than for any previous number. (Although note that since we're taking x to be an integer, the octave will always be perfectly approximated.) These minimal values should approximate the primes from 2 up to the specified limit fairly well, working good for an all-around EDO. (The idea to do this came from this article.)

Find EDO for primes
Maximum prime: Max EDO:

You may need to adjust the settings a bit, but you'll see quite a lot of numbers pop out, particularly 7, 12, 22, 31 and 41. If you want examine in greater depth any one of them, this next widget is also very useful for doing precisely that. (Just be careful, the page will lag quite a lot if you choose small errors!)

Test EDO
Rational approximation margin of error (±): mO EDO:
Root pitch: Hz Number of approximations:

So, as we've seen, these systems work really fine when using the right integer, but what if we wanted purer harmony? What else can we do?

Is transposability even that important at all?

Ditch equal division

Remember when I said a bit above that you may not have been convinced that being able to reliably transpose melodies was so important? Well, if so, this tuning method is just the right one for you. (Pun intended.)

In what is known as just intonation, every single interval can be represented as the ratio of two integers. There are many ways to generate such a tuning system, and we'll try to devise various such methods to see what we can achieve.

The most natural one (at least to me) would be to fix a single root note (along with those a number of octaves up or down, of course), and then choose some nice ratios to fill in the gaps. To hear what ratios might sound nice, you can use the following widget, which lets you choose between hearing the sound as a sine wave (as we have done so far), or as other simple waves, such as the triangle wave, the square wave and the sawtooth wave (since at least from my experience, complex ratios sound better when using them – particularly true for the triangle wave).

Test interval
Root pitch: Hz Interval: :

A literally infinite amount of tuning systems can be created in this way. The problem is, even if your notes all sound good when played together with the root, you still need to guarantee they'll sound good between themselves. There are various options to do this.

One is to take some inspiration from equal tuning. Just as we've seen up until now equal tuning as an approximation of just intonation (implicitly), we can do the opposite, with the advantage that if we pick intervals that are consonant when played with the root, every other interval should sound ok too, because of the roughly equal temperament. (We can even see these discrepancies as "flavors" of the chords.) Below, we have the same generator for EDO system as above, but instead of playing the exact notes, it plays the first rational approximation for them that it finds.

Test EDO (as just intonation)
Rational approximation margin of error (±): mO EDO:
Root pitch: Hz Number of approximations:

Of course, you don't actually need the notes you'll be using to be close together in such a manner, as our major scale suggests – the notes in our well-known C, D, E, F, G, A, B, C scale can be either one twelfth or two twelfths of an octave apart. There'll be no widget for this one, but you can just hear some ratios and try to figure out on your own which ones could go well together (this truly is about experimenting!).

The Xenharmonic Wiki is a particularly good source for such types of scales. There are many types, and generating them can be done in various ways. So really, the best you can do is pay a visit.

There's one last category I want to talk about, and it involves something known as the harmonic series, or overtone series. Basically, when you hear a violin, or a guitar, maybe, play a C, you're not actually hearing the single frequency corresponding to that C – they'd sound the same otherwise. Instead, you're hearing lots of other frequencies at the same time, especially those at integral multiples of the original frequency. These notes are called harmonics or overtones, and they're particularly useful as practically any two small overtones, when played together, will sound very harmonious. This can therefore be used to construct all sorts of scales. With the following widget, you can experiment with the first few overtones of any note, and with them, building a scale shouldn't be hard at all.

Overtone series
Root pitch: Hz Number of harmonics:

Ditch the octave

This last one isn't so much of an option as it is a warning. The octave is easily the most consonant interval that we have (other than the trivial unison), so much that across advanced cultures all over the world, notes one octave apart one from another are named equally (our most common system is no exception to this rule). In fact, this "octave equivalence" has even been observed in other animals.4However, if your goal is to achieve many distinct intervals in your scale, or to try out unusual chords, the octave may well be preventing you from this.

By far the most famous tuning system that does this is the Bohlen-Pierce scale, which divides the tritave (as the 3:1 interval is sometimes deemed) into 13 equal parts. The approximation this interval gives to the octave is less than poor, coming at a whopping 24.64 mO difference. (Even so, studies have shown that the brain seems to like slightly detuned octaves4. However, this only applies for octaves detuned upwards, and it turns out this isn't the case here). But the approximations the system gives to other ratios such as 97, 75 and 53 are much better than the ones 12EDO could possibly give us. Here's a quick demonstration. The note names and ratios were taken from here.

Note name Ratio to root note Decimal approximation Representation as ratio (with C) Play notes
C 1 1 1:1
C# 133  1.08818 27:25 (+10.89 mO)
D 1332 1.18414 25:21 (-7.7 mO)
E 1333 1.28856 9:7 (+3.19 mO)
F 1334 1.40219 7:5 (+2.25 mO)
F# 1335 1.52584 75:49 (-4.51 mO)
G 1336 1.66039 5:3 (-5.44 mO)
H 1337 1.80681 9:5 (+5.44 mO)
H# 1338 1.96613 49:25 (+4.51 mO)
J 1339 2.13951 15:7 (-2.25 mO)
A 13310 2.32818 7:3 (-3.19 mO)
A# 13311 2.53348 63:25 (+7.7 mO)
B 13312 2.75689 25:9 (-10.89 mO)
C' 3 3 3:1

Not half bad if you ask me. The difference between this scale and our 12EDO standard is quite noticeable, and music written in Bohlen-Pierce tends to sound close to alien. Yet, it's still music, and the same basic concepts that make our scale hold make this one work just as well.

Although the easiest way to visualize this scale is by considering it a division into 13 parts of the tritave (13EDT, or 13ED3), we could also construct it by dividing a single octave into a piece of about 18.20209 of an octave, and then repeating this interval indefinitely. In other words, Bohlen-Pierce can be visualized approximately as a 8.20209EDO. By noticing the obvious generalization, we can construct these sort of EDOs with any positive real number we can think of. Some of them might approximate various non-octave intervals pretty well, some others will just sound disordered. But the possibilities are endless. And you really can't explore them without trying them out.

Test EDO (generalized)
Rational approximation margin of error (±): mO EDO:
Root pitch: Hz Number of approximations: Number of notes:


Did all of this convince you to try something other than our twelve note system? Yes? Then maybe you can try to put into use some of the tricks available, such as generalizing the circle of fifths, the use of various commas, and of course, the use of ratios involving primes such as 7, 11 or 13. And even if I didn't convince you that these options are better, why not try them out?

In the end, music is about experimentation, and what better way is there than just trying out new stuff? Just have some fun.


Stephen Weigel suggests I should "use sawtooth waves instead of sine-waves [since] sine waves actually are not good for detecting lock and ring [when overtones of different notes coincide], while sawtooth waves are excellent". Since overtone melding is actually one of the key characteristics for an interval to sound harmonious (something I've learned since writing this), I'll be taking this suggestion into account by using the slightly less aggressive triangle waves in future articles.

Marco Shulter suggests that when I talk about consonance, I should "[speak] of degrees of simplicity and complexity in sonorities, or more blending as compared to more tense, rather than better and worse". He then goes on to argue that he considered 6437, the interval I had chosen, to be "a superb interval that invites two standard resolutions: either expanding stepwise to an octave (like a very large major sixth, e.g. 12/7) or contracting stepwise to a fifth like a very small minor seventh (e.g. 7/4)". Although I still believe said interval is still quite dissonant on its own when played with most instruments (see above), which was the point I was trying to make, I agree that my choice of words could have been better, and I'll also be taking it into consideration.


  1. Audio Processing. In Smith, S.W. (1997). The Scientist and Engineer's Guide to Digital Signal Processing. Retrieved December 7, 2017, from http://www.dspguide.com/ch22/1.htm.
  2. Dominik, B. (2006). Instrument Timbres and Pitch Estimation in Polyphonic Music (Master's thesis). Retrieved December 7, 2017, from https://pdfs.semanticscholar.org/4131/acf9204272d28ed07925060a0536aab81e01.pdf.
  3. Drozdowski, T. (2013, Jan. & feb.). Eddie Van Halen Revolutionizes Rock Guitar. Retrieved January 07, 2018, from http://www.gibson.com/News-Lifestyle/Features/en-us/Eddie-Van-Halen-Revolutionizes-Guitar-0102-2013.aspx.
  4. Deutsch, D. (1999). The psychology of music (2nd ed.). Retrieved from https://books.google.com.mx/books?id=A3jkobk4yMMC&lpg=PP1&pg=PP1#v=onepage&q&f=false.


Popular posts from this blog

JSynth Documentation