The Musical Scale

[url=https://remote.rsccd.edu/en/music-scale-notes-musical-melody-38675/,DanaInfo=pixabay.com,SSL+]"C-Major Scale"[/url] by Clker-Free-Vector-Images is in the [url=https://remote.rsccd.edu/publicdomain/zero/1.0/,DanaInfo=creativecommons.org+]Public Domain, CC0[/url][br]
The 12 Notes in an Octave
If you play music you know that there are 12 steps if you start at any note and end one octave higher (on the 13th note).  That begs the question about the naming of the [i]octave.[/i]  Obviously "oct" means eight.  If you look at the musical scale above, it goes from a musical note named "C" to the same note one octave higher (also a "C") and back down again. The eighth and highest note is the octave. There are five notes not played in that scale above. [br][br]So the reason we call it an octave, as if it is only eight notes, is that playing a piece of music in any key (combination of notes that tend to sound good together) only typically requires seven of of the 12 notes, where the 12th step (or 13th note) is the octave.  The five notes that are left out tend to sound a bit dissonant to the ear when played in combination with the other seven notes.  They certainly get used, but are referred to as "accidentals" to a musician. They add dissonance of the sort we're used to hearing in Jazz.[br][br]I tend to wonder about many things.  For instance, when I started playing music, I wondered if 12 tones were chosen because that's what is best, or if it was like using the English system of measurement in the USA where stubborn persistence is the reason we keep using it rather than doing it because it's the best way.[br][br]It turns out that [b]12 tones [/b][i][b]is[/b][/i][b] the best solution to the problem of trying to come up with the highest likelihood that any two notes played simultaneously on an instrument would sound good together[/b].  You might think that "sound good" is subjective, but we can actually quantify it.  But before we get to that discussion, I want to show you how the 12 tones or notes are arranged, and will convince you that 12 is best.[br][br]The musical pitch (high or low tone) is related mathematically to the frequency of the sound wave. We will see soon that you never really only play a single frequency, but nonetheless, the pitch corresponds to the lowest frequency that a key on a piano or string on a guitar produces. [br][br]The 12 tones, or notes in our musical scale, are related exponentially in frequency one to the other.  Starting at any note of frequency [math]f_0[/math], we find that a note [i]n[/i] steps above the starting note will have a frequency [i]f[/i] given by [center][math]f=f_0 2^{n/12}.[/math][/center]It's easy to see that if we set [i]n=12[/i] we get a doubling of frequency.  [b]A doubling in frequency is an octave[/b].  It is the most harmonic sound in music, and happens to be the first two tones played in the well known tune "Somewhere Over the Rainbow". Try it out on the keyboard below. The notes play true tones based on the tuning standard of the note called middle-C being tuned to a frequency of 261.6 Hz. The names of the notes show up when you press the keys.
Musical Intervals
The value of 'n' in our equation corresponds to the number of steps that a higher note is above a starting note. The starting note is often called the [b]root note[/b]. Technically the steps are called [b]half steps[/b] or [b]semi-tones[/b] to a musician. [br][br]When a note n steps above a root is played, it is assigned a name like: minor 3[sup]rd[/sup] or perfect 4[sup]th[/sup] or major 2[sup]nd[/sup]. A list of the names of these [b]intevals[/b], as they're called, is shown in this table. The symbol for minor is 'm', for major is 'M', and for perfect is 'P'. [br][br][table][tr][td][u]n[/u][/td][td][u]Interval name[/u][/td][/tr][tr][td]0[/td][td]Perfect unison[/td][/tr][tr][td]1[/td][td]minor 2nd[/td][/tr][tr][td]2[/td][td]Major 2nd[/td][/tr][tr][td]3[/td][td]minor 3rd[/td][/tr][tr][td]4[/td][td]Major 3rd[/td][/tr][tr][td]5[/td][td]Perfect 4th[/td][/tr][tr][td]6[/td][td]augmented 4th or diminished 5th[/td][/tr][tr][td]7[/td][td]Perfect 5th[/td][/tr][tr][td]8[/td][td]minor 6th[/td][/tr][tr][td]9[/td][td]Major 6th[/td][/tr][tr][td]10[/td][td]minor 7th[/td][/tr][tr][td]11[/td][td]Major 7th[/td][/tr][tr][td]12[/td][td]Perfect octave[/td][/tr][/table]
12 Notes is Best
If the musical world used anything other than a 12 note octave, and you wished to find the frequencies of the notes, you'd just substitute that number for the 12 in the equation above.  For instance, if it was just five steps to the octave, the equation would simply be [math]f=f_02^{\frac{n}{5}}[/math].[br][br]In the plot below I have indicated with black dots the relative frequencies of the tones in the 12-tone octave.  I have also created a slider that allows you to compare those to the tones that would be created in a scale with [i]n[/i] tones to complete the octave (or doubling of pitch, since it wouldn't make sense to call it an octave anymore).  The vertical lines are small-integer ratios such as 2/1, 3/2, 4/3, etc.  Those are there because they are the ones that sound most harmonic to the human ear.  This is an important first fact about harmony.  [b]Any two notes played together tend to sound good if their frequencies are small-integer ratios of one another. [/b]We will discuss harmony further in a later section, but[b] [/b]if you'd like to read more about the precise tunings of modern instruments in relation to these frequency ratios, a good place to start and to go deeper would be reading about equal temperament.  There is a lot more to music and harmony than meets the ear, and I can only scratch the surface here for lack of time to devote to this topic.[br][br]In any case, you can see below that 12 tones is the scale that has the most notes near to these small-integer valued ratios.  At the top of each vertical line is the name of the musical intervals for those familiar with basic music theory.  In the table are calculated the ratios [math]f/f_0[/math] to see how close many are to perfect small-integer ratios.

Information: The Musical Scale