# Music Theory/The Physics of Music

Western music theory is based mostly on the findings of the ancient Greek philosopher Pythagoras.

## Anatomy of Sound
### Waves

Almost all instruments that contribute to western music either generate sound through the vibration of strings or through the vibration of air in a column. Both of these form regular, recurrent disturbances in the air which reach our ears and are processed as sound by the brain. These recurrent disturbances are known as waves due to their similarity to disturbances in bodies of water.
All waves have a frequency, which is how often the air molecules go from being compressed to being stretched out to being compressed again. Frequency is measured in Hertz (abbreviated Hz), which is the number of compressions and stretches which happen every second. For example, the standard by which a majority of Western music is tuned puts the note A$_4$ at exactly 440 Hz, and tunes everything else relative to that note. Waves also have an amplitude, which is how much the air compresses or stretches in every repetition, or how loud the wave will sound.

### Harmonics

The fundamental frequency is the base frequency at which a string or air column vibrates. The purest kind of wave is a sine wave because it only contains the fundamental frequency and nothing else. A sine wave can be visualized by graphing the function $f(x)=a\sin(h\pi x)$ where $a$ is the amplitude and $h$ is the frequency in Hertz. High points and low points in the graph represent compressions and stretches in the air.
Most instruments, however, do not produce a pure sine wave, because strings and air columns don't tend toward the fundamental frequency only. They also tend to produce additional tones called overtones or harmonics, which have frequencies at integer multiples of the fundamental; that is, they have two times the fundamental frequency, three times the fundamental frequency, four times, five times, six times, and so on. These overtones collectively make up the overtone series; including the fundamental frequency, they make up the harmonic series. Generally, the higher the harmonic, the exponentially smaller the amplitude, but any harmonic can occur at any amplitude depending on the string, air column, resonating chamber, among other factors; this is the reason different instruments have different timbres, or sound different. In fact, by using harmonics at different amplitudes, any sound or wave can be recreated.
It is relationships within the harmonic series that dictate what will sound objectively consonant or dissonant. For instance, almost all cultures utilize some form of the octave in their music because it is the relationship between the fundamental frequency and the first overtone, or between the first harmonic (same thing as the fundamental) and the second harmonic. One might also say these frequencies have a 2:1 ratio. Many cultures also value the fifth because it is the relationship between the second and third harmonics, or have a 3:2 frequency ratio. The simpler the ratio, the more consonant the interval.
For this reason, intervals like seconds, thirds, sixths, and sevenths are considered consonant:
* the major second is a 9:8 ratio
* the minor third is a 6:5 ratio
* the major third is a 5:4 ratio
* the minor sixth is a 8:5 ratio
* the major sixth is a 5:3 ratio
* the minor seventh is a 16:9 ratio
* the major seventh is a 15:8 ratio
And intervals like the unison, fourth, fifth, and octave are considered almost fundamental consonances:
* the perfect unison is a 1:1 ratio
* the perfect fourth is a 4:3 ratio
* the perfect fifth is a 3:2 ratio
* the perfect octave is a 2:1 ratio
The major triad can be expressed as the relationship between three harmonics, as a 4:5:6 ratio between three tones. With this, it is even possible to construct a full major scale using relationships in the major triad.

## Tuning

However, the music we listen to is not actually tuned exactly to the intervals found in the harmonic series, for various practical reasons.

### Just Intonation

Let's suppose a world in which everyone did tune according to the harmonic series. This sort of practice is known as just intonation, the natural way all things "should" be tuned.
Let us now inspect the tuning in a snippet of music by sixteenth-century mathematician Giambattista Benedetti:
Assuming the key of G, we can start by taking the first G$_3$ in the bass clef as the base frequency, from which we will tune everything else. In terms of ratios, this G has a 1:1 ratio with itself. The D$_4$ in the treble clef above should have a ratio of 3:2, since it is exactly a perfect fifth above the initial G. The G$_4$ above that, then, has a ratio of 2:1, since it is exactly an octave above the initial G.
In the next beat, the A$_4$ in the treble clef should have a ratio of 9:4, since it is a 3:2 fifth above the preceding D, and ${\frac {3}{2}}\times {\frac {3}{2}}={\frac {9}{4}}$.
In the third beat, we leave the original G and D, and move to two new notes. Since these notes are played with a suspended A in the treble clef, these notes should be tuned relative to that A, instead of to the previous G and D. So here, the E$_4$ in the treble clef is a fourth below the 9:4 A. ${\frac {9}{4}}\div {\frac {4}{3}}={\frac {27}{16}}$, so the new E should be a 27:16 ratio. The C$_4$ in the bass clef should be tuned a 5:4 major third below that C; since ${\frac {27}{16}}\div {\frac {5}{4}}={\frac {27}{20}}$, the C should be tuned at 27:20.
In the final beat, the G$_4$ comes back in the treble clef. This should be tuned a 3:2 fifth above the C being held in the bass clef. ${\frac {27}{20}}\times {\frac {3}{2}}={\frac {81}{40}}$, so this G is now tuned at 81:40.
If we repeat the phrase, the starting G$_3$ must be tuned a 2:1 octave below the final G, which results in a final ratio of 81:80 because ${\frac {81}{40}}\div {\frac {2}{1}}={\frac {81}{80}}$. This, of course, is slightly higher than the G we started with.
The reason just intonation doesn't work is because it gets unwieldy very quickly, as we saw. Chord progressions like this snippet can cause the pitch to drift by very slight intervals. In this instance, the pitch slid up by a 81:80 ratio, known as the syntonic comma. In the diatonic scale mentioned earlier, the ratio between the major second and the major sixth is a perfect fifth off by a syntonic comma.
Needless to say, as music grew more complex, a less unwieldy, more practical tuning standard had to be developed.