# Music theory/Introduction

Music theory is the study of music, based on harmony, melody, rhythm, etc. Scales are used for harmony and melody.

## Prerequisites

Rational numbers

## Intervals

An interval is the ratio of two frequencies. Simple ratios form perfect harmony (consonance), whereas more complex ones (if they're too distant from a simple ratio) form dissonance. This is for two reasons:
* Notes close together in frequency, when played together, will beat at the rate of the difference of frequencies. Activity: Play two consecutive notes on musical instrument simultaneously. You may notice a beating effect.
* If one plucks a string (or blows into a tube), a frequency will be made, but so will overtones.
This therefore means that if you play two notes sufficiently far from simplicity in ratios, the overtones will rapidly beat, causing dissonance.
The most consonant interval (apart from unison) is the octave, a 2/1 ratio. In fact, octaves sound so pleasing, that notes an octave apart sound like different versions of each other. Next comes the 3/1 ratio, the perfect twelfth.

## Scales
### Constructing a scale

With the two aforementioned notes, a scale can be formed (by octave reduction):
| Interval from root | 1/1 | 3/2 |
| Next note | 3/2 | 2/1 |
| Distance to next note | 3/2 | 4/3 |
As it turns out, the frequency gaps are too large. Let's add more notes:
| Interval from root | 1/1 | 3/2 | 9/8 | 27/16 | 81/64 |
| Next note | 9/8 | 27/16 | 81/64 | 2/1 | 3/2 |
| Distance to next note | 9/8 | 9/8 | 9/8 | 32/27 | 32/27 |
This is the pentatonic scale, though 32/27 sounds fairly large. Let's keep going:
| Interval from root | 1/1 | 3/2 | 9/8 | 27/16 | 81/64 | 243/128 | 729/512 |
| Next note | 9/8 | 27/16 | 81/64 | 243/128 | 729/512 | 2/1 | 3/2 |
| Distance to next note | 9/8 | 9/8 | 9/8 | 9/8 | 9/8 | 256/243 | 256/243 |
This is the Lydian scale. We can build more modes from this by starting at different notes:
| | Root | Second | Third | Fourth | Fifth | Sixth | Seventh |
| Lydian | 1/1 | 9/8 | 81/64 | 729/512 | 3/2 | 27/16 | 243/128 |
| Ionian (major) | 1/1 | 9/8 | 81/64 | 4/3 | 3/2 | 27/16 | 243/128 |
| | 1/1 | 9/8 | 81/64 | 4/3 | 3/2 | 27/16 | 16/9 |
| | 1/1 | 9/8 | 32/27 | 4/3 | 3/2 | 27/16 | 16/9 |
| (minor) | 1/1 | 9/8 | 32/27 | 4/3 | 3/2 | 128/81 | 16/9 |
| | 1/1 | 256/243 | 32/27 | 4/3 | 3/2 | 128/81 | 16/9 |
| | 1/1 | 256/243 | 32/27 | 4/3 | 1024/729 | 128/81 | 16/9 |
The table above goes from Lydian, the brightest mode, to Locrian, the darkest mode. Each row can be formed by starting at the fifth of the previous.
This notion of going up fifths is called the circle of fifths.

### Relative and Parallel Keys
#### Parallel Keys

Parallel keys are...

## Note Names

Notes are named in the following way:
Let's start from D. A perfect twelfth above it is assigned the letter 4 letters higher, and a perfect twelfth below it is assigned the letter 4 letters lower (with wrapping around from G to A). This gives the following note names:
| Name | F | C | G | D | A | E | B |
| Frequency (after octave reduction) | x32/27 | x16/9 | x4/3 | x1 | x3/2 | x9/8 | x27/16 |
Then, we run into a problem:
| Name | B | F | C | G | D | A | E | B | F |
| Frequency | 128/81 | x32/27 | x16/9 | x4/3 | x1 | x3/2 | x9/8 | x27/16 | x81/64 |
There is a solution though- add a flat to the new B (as it's pitched lower than the old B), and a sharp to the new F (as it's pitched higher than the old F).

## Tuning problems

However, it's not all sunshine and rainbows. These are the two problems with this system:

### Impossibility of a perfect system

a) The system is infinite; scaling by three repeatedly will never be the same as scaling by 2 repeatedly (one side always scales by an even number; the other side always scales by an odd number). 12 gets close though:
| F | F# | G | G# | A | A# | B | C | C# | D | D# | E |
| 1/1 | 2187/2048 | 9/8 | 19683/16384 | 81/64 | 177147/131071 | 729/512 | 3/2 | 6561/4096 | 27/16 | 59049/32768 | 243/128 |
A more common approach was to start at D and go symmetrically up and down (the ratios become cleaner- but don't be fooled; the relationships are still the same- a scale from F in the former is the same as one from Eb/Ab in the latter)
| D | Eb | E | F | F# | G | ? | A | Bb | B | C | C# |
| 1/1 | 256/243 | 9/8 | 32/27 | 81/64 | 4/3 | ? | 3/2 | 128/81 | 27/16 | 16/9 | 243/128 |
Maybe a perfect system can be formed with different scaling factors? This idea can be shot down fairly easily in all 'nice sounding' cases:
| Interval 1 | Interval 2 | Reason of Incompatibility |
| 2 | 7/4 | Scaling by the former always gives an integer, whilst scaling by the latter always gives the ratio of an odd and even number |
| 2 | 3/2 | Scaling by the former results in an integer, whilst the latter gives the ratio of an even and odd number |
| 2 | 4/3 | Scaling by the former results in an integer, whilst the latter gives the ratio of an even and odd number |
| 2 | 5/4 | Scaling by the former results in an integer, whilst the latter gives the ratio of an odd and even number |
| 2 | 6/5 | Scaling by the former results in an integer, whilst the latter gives the ratio of an even and odd number |
| 7/4 | 3/2 | Scaling by the former results in a denominator divisible by 7, whereas the latter doesn't |
| 7/4 | 4/3 | Scaling by the former results in an odd numerator, whilst the latter gives an even numerator |
| 7/4 | 5/4 | Scaling by the former results in numerator divisible by 7, whereas the latter doesn't |
| 7/4 | 6/5 | Scaling by the former results in an odd numerator, whilst the latter gives an even numerator |
| 3/2 | 4/3 | Scaling by the former results in an odd numerator, whilst the latter gives an even numerator |
| 3/2 | 5/4 | Scaling by the former results in a numerator divisible by 3, whereas the latter doesn't |
| 3/2 | 6/5 | Scaling by the former results in an odd numerator, whilst the latter gives an even numerator |
| 4/3 | 5/4 | Scaling by the former results in an even numerator, whilst the latter gives an odd numerator |
| 4/3 | 6/5 | Scaling by the former results in a denominator divisible by 3, whereas the latter doesn't |
| 5/4 | 6/5 | Scaling by the former results in an odd numerator, whilst the latter gives an even numerator |
Assign determining the reasons as an activity

### Partial solution

To solve this problem of the fifths not lining up with the octaves, we can cheat. Apon noticing that 12 perfect fifths is just over 7 octaves, we can simply flatten the fifth to ${\sqrt[{12}]{128}}$, to make 12 fifths equal 7 octaves. This may make you concerned; however, this is fine- the beating is difficult to perceive. This is called 12-tone equal temperament, and is the current global standard

#### Enharmonic equivalence

An interesting effect of this is enharmonic equivalence.
Note that this is unique to equal tempered scales, which is why it's important that notes are 'spelled correctly' (e.g., a major second below F is Eb, not D#)

### Dissonance of the scales

b) A lot of the notes sound dissonant. The scales would sound nicer like this instead:
| | Root | Second | Third | Fourth | Fifth | Sixth | Seventh |
| Lydian | 1/1 | 9/8 | 5/4 | 7/5 | 3/2 | 5/3 | 15/8 |
| Ionian (major) | 1/1 | 9/8 | 5/4 | 4/3 | 3/2 | 5/3 | 15/8 |
| | 1/1 | 9/8 | 5/4 | 4/3 | 3/2 | 5/3 | 9/5 |
| | 1/1 | 9/8 | 6/5 | 4/3 | 3/2 | 5/3 | 9/5 |
| (minor) | 1/1 | 9/8 | 6/5 | 4/3 | 3/2 | 8/5 | 9/5 |
| | 1/1 | 16/15 | 6/5 | 4/3 | 3/2 | 8/5 | 9/5 |
| | 1/1 | 16/15 | 6/5 | 4/3 | 7/5 | 8/5 | 9/5 |
This gives us the names of intervals:
| Interval name | Ratio |
| Unison | 1/1 |
| Minor second | 16/15 |
| Major second | 9/8 |
| Minor third | 6/5 |
| Major third | 5/4 |
| Perfect fourth | 4/3 |
| Tritone | 7/5 |
| Perfect fifth | 3/2 |
| Minor sixth | 8/5 |
| Major sixth | 5/3 |
| Minor seventh | 9/5 |
| Major seventh | 15/8 |
However, the system falls apart completely, as you'd need to retune your instrument every time you wanted to change keys, even to a parallel one where all the notes should be the same! For instance, if your instrument is tuned to C major and you try to play in A minor, the fourth is the dissonant 27/20, rather than the consonant 4/3 that's supposed to be there!

## Chords

Chords are a fundamental part of harmony. There are formed by playing multiple notes simultaneously. There are two 'simple' types of chords, major and minor.

## Rhythm

Rhythm is another aspect of sound...

## Other resources

List of English interval names: