## The mathematics underlying music

Did you know that almost all Western music is based on an approximation? 524288 = 531441 to be precise (which is true to an accuracy of about 1.3%). These numbers are quite special:
524288 = 212
531441 = 319
Their ratio is called the Pythagorean comma and is the difference between 12 perfect fifths and 7 octaves. In Western music this ratio is treated identically to 1 (i.e. if you go up a fifth 12 times you'll end up on the note you started with, 7 octaves up). This approximation caused an enormous amount of trouble for early piano tuners.

Making this sort of approximation is quite important otherwise there would be an infinite number of notes (if you keep going up in intervals of fifths and going down in intervals of octaves you never get to exactly where you started).

But if we're using computers instead of more primitive instruments to make music, having an infinite number of possible notes doesn't really matter - the computer can represent them as exactly or approximately as you like, making it possible to do perfect just intonation and use any intervals you like without approximating.

The really interesting thing about thinking about intervals instead of "the 12 notes" is (for me) not so much that the different sounds are possible but that the underlying harmonic structure of the music is made explicit. The musical stave with its lines, spaces, sharps and flats has evolved rather than being designed and as such seems to hide the underlying intervals rather than revealing them. A fifth, for example, can be represented by 2 units, 2 units plus an accidental or 2 and half units plus an accidental depending on the note and key signature. But when the music is played they all sound like the same interval.

A much more logical stave would have time going down the vertical axis and frequency along the horizontal axis. Vertical lines would represent notes of constant pitch and horizontal lines would represent particular intervals. The horizontal scale should be made logarithmic so that a particular interval would be the same length no matter what its absolute pitch is. Intervals would be marked with their ratio to make it clearer what they really mean (though with practice it would probably be possible to read this kind of stave by eye without the interval markings). So if an octave is represented by 30mm, a perfect fifth (marked $\frac{3}{2}$) would be represented by 17.5mm ($\displaystyle 30\frac{\log \frac{3}{2}}{\log 2}$) and a major third ($\frac{5}{4}$) by 9.7mm ($\displaystyle 30\frac{\log \frac{5}{4}}{\log 2}$).

I ought to try drawing various pieces of music like this to see how it looks. It would also be much easier to write music using "weird" intervals like 7/4 and 12/11 using this stave.

### One Response to “The mathematics underlying music”

1. [...] blog Stuff I think about « The mathematics underlying music Robot squirrel [...]