Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

The division of the chromatic scale in 7 natural notes (white keys in a piano) and 5 accidental ones (black) seems a bit arbitrary to me.

Apparently, adjacent notes in a piano (including white or black) are always separated by a semitone. Why the distinction, then? Why not just have scales with 12 notes? (apparently there's a musical scale called Swara that does just that)

I've asked several musician friends, but they lack the math preparation for giving me a valid answer. "Notes are like that because they are like that".

I need some mathematician with musical knowledge (or a musician with mathematical knowledge) to help me out with this.

Mathematically, is there any difference between white and black notes, or do we make the distinction just for historical reasons?

share|improve this question
10  
I guess I forgot to actually answer your question about the white and black keys. The short answer is that we make an arbitrary choice when we choose to privilege things that are close to C on the circle of fifths, but this arbitrary choice happens to sound fairly nice. (Or does it? Maybe we're just too used to it.) –  Qiaochu Yuan Nov 24 '10 at 10:28
6  
@J.M.: many non-Western scales; see e.g. en.wikipedia.org/wiki/Musical_scale#Non-Western_scales . –  Qiaochu Yuan Nov 24 '10 at 11:33
13  
@Jefromi The white keys also form the dorian scale on D, the phrygian on E, the lydian on F, the mixolydian on G, the aeolian on A, and the locrian on B! This little collection indicates there are deep historical reasons for the patterns of white and black keys that are not directly related to equal temperament or the chromatic ("12 tone") scale. They are best understood in terms of music that emphasized the consonances afforded by octaves, fifths, thirds, and sixths (integral frequency ratios of 2:1, 3:2, 5:4, and 6:5--but not 4:3!). Originally, black keys interpolated notes. –  whuber Nov 24 '10 at 21:39
147  
Obviously, there are plenty of differences between C and C#. For instance, C# relies on a garbage collector to manage memory automatically whereas C requires you to do it manually... Oh, sorry; wrong site. –  LeakyCode Nov 25 '10 at 3:05
6  
Thanks a lot! However, what makes this question great are its answers. –  egarcia Jan 2 '11 at 0:35

20 Answers 20

up vote 318 down vote accepted

The first thing you have to understand is that notes are not uniquely defined. Everything depends on what tuning you use. I'll assume we're talking about equal temperament here. In equal temperament, a half-step is the same as a frequency ratio of $\sqrt[12]{2}$; that way, twelve half-steps makes up an octave. Why twelve?

At the end of the day, what we want out of our musical frequencies are nice ratios of small lintegers. For example, a perfect fifth is supposed to correspond to a frequency ratio of $3 : 2$, or $1.5 : 1$, but in equal temperament it doesn't; instead, it corresponds to a ratio of $2^{ \frac{7}{12} } : 1 \approx 1.498 : 1$. As you can see, this is not a fifth; however, it is quite close.

Similarly, a perfect fourth is supposed to correspond to a frequency ratio of $4 : 3$, or $1.333... : 1$, but in equal temperament it corresponds to a ratio of $2^{ \frac{5}{12} } : 1 \approx 1.335 : 1$. Again, this is not a perfect fourth, but is quite close.

And so on. What's going on here is a massively convenient mathematical coincidence: several of the powers of $\sqrt[12]{2}$ happen to be good approximations to ratios of small integers, and there are enough of these to play Western music.

Here's how this coincidence works. You get the white keys from $C$ using (part of) the circle of fifths. Start with $C$ and go up a fifth to get $G$, then $D$, then $A$, then $E$, then $B$. Then go down a fifth to get $F$. These are the "neighbors" of $C$ in the circle of fifths. You get the black keys from here using the rest of the circle of fifths. After you've gone up a "perfect" perfect fifth twelve times, you get a frequency ratio of $3^{12} : 2^{12} \approx 129.7 : 1$. This happens to be rather close to $2^7 : 1$, or seven octaves! And if we replace $3 : 2$ by $2^{ \frac{7}{12} } : 1$, then we get exactly seven octaves. In other words, the reason you can afford to identify these intervals is because $3^{12}$ happens to be rather close to $2^{19}$. Said another way,

$$\log_2 3 \approx \frac{19}{12}$$

happens to be a good rational approximation, and this is the main basis of equal temperament. (The other main coincidence here is that $\log_2 \frac{5}{4} \approx \frac{4}{12}$; this is what allows us to squeeze major thirds into equal temperament as well.)

It is a fundamental fact of music that $\log_2 3$ is irrational, so it is impossible for any kind of equal temperament to have "perfect" perfect fifths regardless of how many notes you use. However, you can write down good rational approximations by looking at the continued fraction of $\log_2 3$ and writing down convergents, and these will correspond to equal-tempered scales with more notes.

Of course, you can use other types of temperament, such as well temperament; if you stick to $12$ notes (which not everybody does!), you will be forced to make some intervals sound better and some intervals sound worse. In particular, if you don't use equal temperament then different keys sound different. This is a major reason many Western composers composed in different keys; during their time, this actually made a difference. As a result when you're playing certain sufficiently old pieces you aren't actually playing them as they were intended to be heard - you're using the wrong tuning.


Edit: I suppose it is also good to say something about why we care about frequency ratios which are ratios of small integers. This has to do with the physics of sound, and I'm not particularly knowledgeable here, but this is my understanding of the situation.

You probably know that sound is a wave. More precisely, sound is a longitudinal wave carried by air molecules. You might think that there is a simple equation for the sound created by a single note, perhaps $\sin 2\pi f t$ if the corresponding tone has frequency $f$. Actually this only occurs for tones which are produced electronically; any tone you produce in nature carries with it overtones and has a Fourier series

$$\sum \left( a_n \sin 2 \pi n f t + b_n \cos 2 \pi n f t \right)$$

where the coefficients $a_n, b_n$ determine the timbre of the sound; this is why different instruments sound different even when they play the same notes, and has to do with the physics of vibration, which I don't understand too well. So any tone which you hear at frequency $f$ almost certainly also has components at frequency $2f, 3f, 4f, ...$.

If you play two notes of frequencies $f, f'$ together, then the resulting sound corresponds to what you get when you add their Fourier series. Now it's not hard to see that if $\frac{f}{f'}$ is a ratio of small integers, then many (but not all) of the overtones will match in frequency with each other; the result sounds a more complex note with certain overtones. Otherwise, you get dissonance as you hear both types of overtones simultaneously and their frequencies will be similar, but not similar enough.


Edit: You should probably check out David Benson's "Music: A Mathematical Offering", the book Rahul Narain recommended in the comments for the full story. There was a lot I didn't know, and I'm only in the introduction!

share|improve this answer
4  
Before the invention of well and equal temperament, harpsichords had to be retuned each time one wanted to play in a different key, right? So I guess the black/white key distinction got stuck from that period. Just found this. –  Raskolnikov Nov 24 '10 at 11:42
12  
Just to add one sentence that is implicit in Qiaochu's answer: in equal temperament one may as well just have 12 identical keys. But in pythagorean tuning and well-temperament, there's quite a difference between the different keys; hence it is less odd to have the keys not be completely symmetrical. The white keys correspond to the "preferred" diatonic scale of C-major. If you train your ears a bit, you maybe able to hear the difference of, say, Bach's Well-tempered Klavier played on modernly tuned instrument versus a well-tempered one. –  Willie Wong Nov 24 '10 at 11:49
5  
And if you listen to Eastern music (Greek/Turkish music), as long as you have any musical training at all, you will immediately hear the difference of a comma between the major third you are used to and their interval between "C" and "E". But this is getting far from mathematics. –  Willie Wong Nov 24 '10 at 11:53
13  
"The origin of the consonance of the octave turns out to be the instruments we play. Stringed and wind instruments naturally produce a sound that consists of exact integer multiples of a fundamental frequency. If our instruments were different, our musical scale would no longer be appropriate. For example, in the Indonesian gamelan, the instruments are all percussive. Percussive instruments do not produce exact integer multiples of a fundamental... So the western scale is inappropriate, and indeed not used, for gamelan music." -- maths.abdn.ac.uk/~bensondj/html/maths-music.html –  Rahul Nov 24 '10 at 15:17
3  
Excellent answer, Qiaochu; my comment above (which I had to make really curt to have it fit in the length limit) is in regards to your wondering about the physics of vibration. Just to spell it out, most string and wind instruments work by vibrating a practically one-dimensional thing (a string, or a column of air); the modes of vibration in one dimension are just sinusoids, and you can only fit a whole number of them to meet the boundary conditions. (Also, the book I linked above is excellent, and free.) –  Rahul Nov 24 '10 at 15:21

The first answer is great, so I'll try to approach the question from another angle.

First, there are several different scales, and different cultures use different ones. It depends on the mathematics of the instruments as much as on cultural factors. Our scale has a very long history that can be traced to the ancient Greeks and Pythagoras in particular. They noticed (by hearing) that stringed instruments could produce different notes by adjusting the length of the string, and that some combinations sounded better.

The Greeks had a lot of interest in mathemathics, and it seemed "right" for them to search for "perfect" combinations—perfect meaning that they should be expressed in terms of fractions of small integer numbers. They noticed that if you double or halve the string length, you get the same note (the concept of an octave); other fractions, such as $2/3$, $3/4$, also produced "harmonic" combinations. That's also the reason why some combinations sound better, as it can be explained by physics. When you combine several sine waves, you hear several different notes that are the result of the interference between the original waves. Some combinations sound better while others produce what we call "dissonance".

So, in theory, you can start from an arbitrary frequency (or note) and build a scale of "harmonic" notes using these ratios (I'm using quotes because the term harmonic has a very specific meaning in music, and I'm talking in broad and imprecise terms). The major and minor scales of Western music can be approximately derived from this scheme. Both scales (major and minor) have $7$ notes. The white keys in the piano correspond to the major scale, starting from the C note.

Now, if you get the C note and use the "perfect" fractions, you'll get the "true" C major scale. And that's where the fun begins.

If you take any note in the C major scale, you can treat that note as the start of another scale. Take for instance the fifth of C (it's the G), and build a new major scale, now starting from G instead of C. You'll get another seven notes. Some of them are also on the scale of C; others are very close, but not exactly equal; and some fall in the middle of the notes in the scale of C.

If you repeat this exercise with all notes, you'll end up building $12$ different scales. The problem is that the interval is not regular, and there are some imprecisions. You need to retune the instrument if you want to have the perfect scale.

The concept of "chromatic" scale (with $12$ notes, equally spaced) was invented to solve this "problem". The chromatic scale is a mathematical approximation, that is close enough for MOST people (but not all). People with "perfect" ear can listen the imperfections. In the chromatic scale, notes are evenly spaced using the twelfth root of two. It's a geometric progression, that matches with good precision all possible major and minor scales. The invention of the chromatic scale allows players to play music in arbitrary scales without retuning the instrument—you only need to adjust the scale by "offsetting" a fixed number of positions, or semitones, from the base one of the original scale.

All in all, that's just convention, and a bit of luck. The white keys are an "historical accident", being the keys of the major scale of C. The other ones are needed to allow for transposition. Also bear in mind that (1) the keys need to have a minimum width to allow for a single finger, and (2) if you didn't have the black keys, the octave would be too wide for "normal" hands to play. So the scheme with a few intermediate keys is needed anyway, and the chromatic scale that we use is at least as good (or better) as any other possible scale.

share|improve this answer
    
Hi Carlos! Your answer was very good, and it actually helped me understand Qiaochu Yuan's better. I'm giving him the correct response because he was faster, but yours was a close second - so +1 to you, and thanks! –  egarcia Nov 26 '10 at 14:21
3  
I'd say this is the better answer. I know a lot about temperament / tuning, but I find it hard to imagine someone who was new to the subject being able to understand much of what Qiaochu was saying. –  Donkey_2009 Mar 5 '12 at 0:55
1  
@Donkey_2009 how is that relevant? The correct answer need not be understood to be correct. Anyways, the question wasn't about tuning. It was about the white vs. black keys, really. –  sehe Jun 26 '12 at 8:31
1  
There is no "correct" answer here, there are just explicative and enlightening ones. Both these answers are so, in different ways. –  Noldorin Sep 6 '13 at 2:46

The answers given are pretty good from a musical, mathematical, and socialogical / historical reason. But they miss the fundamental reason why there are $12$ notes in a western scale (or $5$ notes in an eastern pentatonic, etc.), and why it's those particular $12$ notes (or $5$).

Qiaochu almost nailed it by pointing out that we like notes which are simple integer ratios. But why? The fundamental reason stems from the physics of common early instruments -- flutes (including the human voice) and plucked strings -- and from the physics of the tympanum in the ear.

As Qiaochu noted, sound is not composed of a single sine wave frequency but rather a sum of many sine waves. The "note" we hear is the frequency of the primary (loudest) wave coming from these instruments. But frequencies exist in that wave as well, albeit largely masked by the primary. These are known informally as harmonics or overtones.

The first several harmonics of flutes and plucked strings are similar and very straightforward: If the primary is normalized to frequency $1$, then the second loudest harmonic is typically $1/2$ (an octave above), the third is usually $1/3$ (an octave and a fifth above), the fourth is usually $1/4$ (two octaves), the fifth is usually $1/5$ (two octaves and a major third), and the sixth is usually $1/6$ (two octaves and a fifth). If the primary note is C1, these translate roughly into C2, G3, C4, E4, and G4. If the harmonics continued in this way -- and they don't always -- various other notes appear.

This matters because if you want to play TWO instruments together, you'd like their harmonics to coincide even if they're playing different notes. Otherwise the excess of harmonics sounds bad to the ear. In the worst case, very close but not entirely overlapping harmonics create "beats" -- seeming alternating loud and soft periods of time -- which are irritating to listen to and tough on the ear.

To get harmonics to coincide in multiple instruments or even successive notes, you have to pick notes for them to play where their harmonics have a strong overlap. For example, this is also why the major fourth is useful even though it doesn't often appear early. It's because if one instrument is playing C, if the other instrument is playing major fourth but lower by an octave, they'll overlap nicely.

I believe these note selections (guaranteeing harmonics in harmony, so to speak) influenced the evolution of scale choices -- especially the pentatonic, that is, the black notes), and the division of the octave into $12$ pieces.

One early instrument which is totally out of whack from this is the bell. Bells and gongs can be tuned to have a variety of harmonics, but the most common ones -- foundry bells -- have a very loud, unusual third harmonic: minor third or E flat. It is so loud and incongruous that they sound terrible, even disturbing, when played along with strings, flutes, voices, etc. In fact, entire musical pieces have to be written specially for carillons (large multibell instruments) in order to guarantee proper overlap of harmonics. Generally this means that the entire piece has to be written in fully diminished chords. Major chords sound among the worst because of the clash between the major third in the chord and the minor third coming from the root's loud third harmonic.

share|improve this answer
2  
Thanks Mr. Foo man for the well thought-out response. –  Ryan Budney Nov 27 '10 at 23:53
    
Very cool answer. :) –  Beni Bogosel May 27 '11 at 6:56
    
+1 for explaining about "beats". I was about to post an answer for that exact reason. –  Tim Seguine Sep 8 '11 at 18:51
    
interesting... bells might be good for blues! :) –  Anentropic Oct 6 at 10:01

The math of frequency relationships here is sound (pun intended) but they don't help explain the white vs black key piano layout.

Here's the historical imperitive thay led to this layout for "Western Music".

First consider the major triad: root + third + fifth notes of the "diatonic scale". They follow the harmonic series: 1 - root 2 - octave (doubling of root frequency) 3 - fifth (triple of the root - 3:2 relationship to the octave) 4 - double octave (4x) 5 - 10th (double octave of a third) 6 - octave fifth

These are notes a static length of tubing can produce by blowing into it: the bugle.

Combinations of these notes create frequencies that make choirs sound heaven-ly. The frequencies align and blend into pure complex vibraations that are the sum and the differencies (harmonic overtones) of these relationships.

Choirs can tune themselves dynamically to create these frequency alignments that are percieved as being perfectly consonant. Upbeat western music focus on the 3 major chords found in the diatonic scale: 1+3+5 root major chord - white keys C - E - G 4+6+1 4th chord - white keys F - A - C 5+7+2 5th chord - whote keys G - B - D

The basics of western folk music are the 1 - 4 - 5 sequences of chords. Learn C, F and G on a guitar and you can play the bulk of the classic Country song book.

Put the notes of these chords into a scale and you get that row of 7 white keys: C - D - E - F - G - A - B (repeat until you can't hear it).

So, they western scale is based upon frequency relationships that make combinations of notes "ring" in consonance in it's purest form... like the Gregorian Chants of the Roman Church.

So, a basic "western keyboard" could be made from just these 7 notes repeated across the frequency spectrum. Look at the layout of a Greek Lyre (a harp) and that's what you will find. A sequence following the diatonic scale which sounds pleasant if you just strum across the strings due to the tuning of even multiples (adjusted by octaves).

OK... now adding the black keys is a compromise of tuning specific notes so that you can build these 1+3+5 chords from any starting point and thus play a song adjusted up or down to any starting point. The piano will never achieve that sonic mathematical glimpse into the "music of the spheres" that the self-adjusting choir can to make a chord mathematically perfect in alignment but it's the "keyboard" for the modern composer... the effective "musical qwerty" that a composer or a pianist begins to visualize chord "shapes" as hand positions.

With a lot of practice a pianist can pre-visualize sound in terms of finger and hand movements much like a solid touch typist starts to set words and sentences as a sequence of movements.

The addition of the black keys was called a "Well Tempered" tuning and Bach was one of the first composers to create whole bodies of compositions that worked through the Major and Minor keys of the 12 scales that you noticed intially when inspecting the keyboard.

If you look into other musical cultures you will find a different approaches to standardizing sound relationships that do not focus on the 1 - 4 - 5 chords. This music to a culturally trained western ear is less predicatable in nature and that lack of predictablility can make the music frustrating or exciting... music "speaks" to us in terms of pure sensory inputs that can move, excite, bore or confuse us.

So, the piano keyboard is designed to be the perfect delivery system for an individual to produce the range of complexity that western music has achieved.

The modern keyboard synthesizers are now able to produce the full range of the western orchestra in terms of "instruments" and I'm hoping someone create one that micro-adjusts notes based upon the surrounding context... shifting a note up or down slightly from the "well tempered" compromise to the pitch that makes a chord "ring" and produce the upper harmonic overtones that make a great orchestra truly "heavenly".

Maybe it's already been done.

share|improve this answer
    
Thank you. Your answer provided historical and some poetical background, as well as purely mathematical. The math part, however, is very similar to Qiaochu's, so I'm giving the answer to him. Yours was quite enjoyable, so +1 to you. You should write more answers here :). –  egarcia Nov 26 '10 at 14:28
    
Your mention of a dynamically self adjusting context based synthesizer strikes me as rather interesting. –  michaelc Nov 29 '10 at 19:41
    
@michaelc I know someone that did just that. I've not heard it, so I'm not sure whether it would really be heavenly. –  sehe Jun 26 '12 at 8:33
    
@michaelc, mcdtracy, and sehe check this out: justonic.com and youtube.com/watch?v=BhZpvGSPx6w –  Ulf Åkerstedt Sep 1 '12 at 22:03

The math in this thread is awesome, but I'm not sure it addresses the original question about the "difference between white and black notes".

The other responses in this thread provide enough math to understand that each octave can be more-or-less naturally divided into twelve semitones. The Western music tradition further evolved to be based around what's called the "diatonic scale".

A musical scale is a sequence of pitches within one octave; scales can be defined by the number of semitones between each successive note.

For example, the Whole Tone Scale consists entirely of whole tones; it has six distinct pitches, each of which is two semitones higher than the last. So you might represent it with the string '222222' — that is, take a note, then the note 2 semitones higher, then the note 2 semitones higher, etc., until the last "2" takes you to the note an octave above where you started.

The Diatonic Scale that Western music is based around could likewise be represented by the string '2212221'.

If you start with a C on a keyboard and go up, you'll see that the white keys conform to that pattern of semitones. That, generally, is why the black keys are in that particular pattern.

Of course, you can start a scale on any pitch, not just C. That's why the "same" diatonic scale in a different key will involve a unique set of sharps and flats.

Now, the Diatonic Scale can also be represented by '2212221' shifted to the left or right any number of times. For example, '2122212', '1222122', etc. are also Diatonic; these are called the "modes" of the Diatonic scale. Each Diatonic mode can be played on only the white keys of the piano by starting on a different pitch.

2212221 is called the Ionian mode (this is also generically called the Major scale), and can be played on the white keys starting with C.

2122212 is the Dorian mode and can be played on the white keys starting with D.

1222122 is the Phrygian mode, starting on E.

2221221 is the Lydian mode, starting on F.

2212212 is the Mixolydian mode, starting on G.

2122122 is the Aeolian mode (the Minor scale), starting on A.

1221222 is the (awesome) Locrian mode, starting on B.

Each mode has its own unique "sound", which (in my opinion, at least) derives precisely from the different placement of the semitones within each scale.

And of course there are scrillions of non-Diatonic scales that have nothing whatsoever to do with how the modern keyboard came to be.

EDIT to add a shorter, less implicit answer: The white keys alone can be used to play the set of diatonic scales listed above; the black keys are "different" because they are the remaining chromatic pitches not used in that set of diatonic scales.

share|improve this answer
    
This was very interesting. I actually thought that the Diatonic Scale was '222222'. So +1 for you. Two things though: a) why do you think Locrian mode is awesome? b) You actually didn't speak about black and white keys at all... maybe you forgot a closing paragraph? –  egarcia Nov 26 '10 at 14:40
2  
I think Locrian is awesome because it's the weirdest sounding mode; it begins with a semitone and doesn't include the perfect fifth above the root. It might not actually be my favorite one to listen to, but it's definitely the weirdest and most unique. As for your point B, I guess I did leave it somewhat implicit; the white keys by themselves play a certain set of diatonic scales, and the black keys are the remaining five pitches not included in that set. –  75th Trombone Nov 26 '10 at 16:59
    
@egarcia: Yes he did. The white keys are the major ("Diatonic") scale with the root-note C. Now, "why is '2212221' the major scale" is another question I am still confused about... –  BlueRaja - Danny Pflughoeft May 19 '11 at 22:28
2  
@BlueRaja - Danny Pflughoeft: There are many ways of expressing how the Major scale is constructed. Here's my favorite: If the fundamental pitch of an instrument is a C1, the first overtone is C2; then G2, C3, E3, G3. So the first 3 unique pitches in this harmonic series are C, E, and G; a pleasant-sounding chord called a major triad. All harmonic series yield major triads this way. Take a pitch, a perfect 5th above it, and a perfect 5th below it, and construct major triads off each note. The unique pitches in that set are the major scale. –  75th Trombone Jul 7 '11 at 19:07
1  
An offtopic aside: the observation that each scale/mode has its own "feel" and "mood" is the starting point of Indian classical music, which develops the idea to a much greater extent than Western classical music (while entirely ignoring polyphony/harmony, so central in Western music). Each "raga" (or "raag") in Indian classical music is sort of like a scale/mode (with constraints on order of notes, emphasis, etc.); but instead of ≈ a dozen modes, there are about 50 common ragas and any competent musician knows 200–300. Each raga is meant to induce a specific mood in a (good) listener. –  ShreevatsaR Jul 31 '11 at 15:24

Mathematically, is there any difference between white and black notes, or do we make the distinction just for historical reasons?

There is no mathematical difference between the white and black notes. Adjacent notes on modern piano keyboards are typically tuned 1/12 of an octave apart. Quiaochu explains this most completely, but what it boils down to is that there is no difference.

We haven't always and don't today always use equal temperament on keyboard instruments but even then the difference between white and black notes would be arbitrary.

The distinction is for historical and cultural reasons. There is a cool picture here showing Nicholas Farber's Organ (1361), which used an 8 + 4 layout rather than the modern 7 + 5 layout we see today. http://en.wikipedia.org/wiki/Musical_keyboard#Size_and_historical_variation

There are examples of instruments in use today that use a chromatic keyboard with no differentiation between the "white" and the "black" notes. See the Bayan and the Bandoneon accordion type instruments.

At the New England Conservatory in the classroom where they teach a class on quarter tones, they keep two pianos tuned a quarter tone off from each other. In that case, a full 24-note chromatic quarter tone octave must be played alternating notes on the two pianos.

This is only the beginning of this particular rabbit hole.

share|improve this answer
    
Well actually I think I didn't know enough to ask my question properly. My musical knowledge is so limited that my first impulse was asking "What are the maths behind music". But I thought that wasn't specific enough so I tried something more concrete. The answers I've received to my second answer actually helped me with that first question I didn't know how to ask. I appreciate the point you made with the different keyboard layouts and the classroom. Thanks, +1! –  egarcia Nov 26 '10 at 14:51

Note also that many cultures use a pentatonic scale. This would correspond to playing only the notes CDEGA. As explained in Qiaochu's answer, we want notes that are in small rational intervals, and particularly notes that are in small rational intervals from the tonic. Exactly which set of notes is chosen varies from culture to culture, with Western music using the 7 white keys, but many other cultures only using the 5 pentatonics.

share|improve this answer
6  
True, and another great thing about the piano keyboard is that you have the diatonic scale on the white keys and the pentatonic scale on the black keys. –  Michael Nov 25 '10 at 19:01
    
The pentatonic is familiar to most people from honky-tonk and blues music. The blues scale is very close to a pentatonic. –  isomorphismes Mar 19 '11 at 17:22

Just to let you see that other tunings are possible and thus other keyboards:

http://www.kylegann.com/tuning.html

share|improve this answer
1  
+1 The material of the link and its siblings gives good explanations, and also, I believe in a sense although not spelled out, basis for white and black keys along with a mathematical background in terms of wave length integer ratios. –  Ulf Åkerstedt Sep 1 '12 at 22:04

To add to this thread, you can understand why certain notes sound good/bad together by looking at trig sum/product formulas, e.g.:

cos(a) + cos(b) = 2 * cos(a - b) * cos(a + b)

What this means is that when you add two tones/frequencies 'a' and 'b', it is equivalent to taking one wave of frequency 'a + b' and modulating its amplitude with another of frequency 'a - b'. The frequency 'a + b' will be a faster vibration, and the frequency 'a - b' will be a slower vibration.

When the two original frequencies are close (e.g. A = 440Hz and A# = 466Hz), the 'a - b' component will be heard as an unpleasant low frequency beating (here, 26Hz).

When the two original frequencies are integer ratios of each other (e.g. 3/2, 4/3) as in chords, then the resulting 'a + b' and 'a - b' frequencies will also be integer ratios of each other. The resulting wave will be simple and sounds harmonious. This is why integer ratios of notes are so important in music.

It helps to plot sums of sines graphically to see this in action.

share|improve this answer
3  
This seems to be an "appealing and popular, but incorrect explanation", dating to Galileo. See the introduction of the book mentioned above "Music: A Mathematical Offering". –  ShreevatsaR Nov 26 '10 at 6:04

Start at F and go up a fifth (to C).

piano

(In a keyboard with 12-key octaves, that's 7 steps.) Repeat that process (through the circle of fifths). You'll hit all the white keys and then all the black keys -- F, C, G, D, A, E, B, F#, C#, G#, D#, A# -- note, these keys are usually represented with flats). So it turns out if you're splitting tones on 3 : 2 (fifth) or 4 : 3 (fourth), the least common multiple is twelve. In practice, the 3 : 2 is similar enough that it gives a sort of 'secure' or content feeling. The 4 : 3 gives a slightly edgier feeling but one which is somewhat counterposed perfectly against this secure feeling. So a fourth + a fifth will give you an octave. So why we want all twelve keys is that we're saying that we want the fifth (dominant) and the fourth (subdominant) to come together and make a whole. This is sort of mirrored with the fact that the first 7/12 of the circle of fifths form the basis and the second 5/12 are 'overlayed' on top (with black keys).

share|improve this answer

If you only had a repetitive series of keys on your piano it would be a bit difficult to visually get some reference points. I think this is the main reason wh

share|improve this answer

Check out this paper which is about the regular 12-gon and music theory. It will help you answer this question, as well as many others that are similar to it.

share|improve this answer

Other responses do a good job of explaining the 12-note chromatic scale. From those 12 tones, if one starts to build a series of tones starting on a single note and going up the circle of fifths, there are two natural stopping points where you have a complete-sounding scale that spans the octaves and has relatively equal spacing between the notes with no gaps: five notes, which gives whole-step and minor-third intervals; and seven notes, which gives whole-step and half-step intervals. These two scales (pentatonic and heptatonic) correspond to the spacing of the black keys and white keys on the keyboard. They are mirror images of each other around the circle of fifths. So the two colors of notes are not "different," but rather a natural division into two symmetrical sclaes built from going opposite directions around the circle of fifths.

In the standard tuning system C is "privileged" because it is (essentially) the note where we start building the circle of fifths to create these two scales.

share|improve this answer
1  
For the final sentence: no. As the answer by Tom Harada shows, you get the white keys (before the black ones) when you start building fifths on F, not on C. If there is any reason that C is privileged (given the separation into white an black keys) is that the Ionian mode (Major scale) has turned out to be predominant in Western music (see answer by 75th trombone). The fact that the naming of notes by letters (in English) starts from A, not C, suggests that maybe Aeolian mode (Minor scale) was predominant at some earlier point in time. –  Marc van Leeuwen Dec 20 '12 at 8:00

The "circle of fifths" is a by product of the preference for diatonic scales. If you layout the chromatic (12-tone) scale without the white and raised black arrangement you'd use the same logic to describe a "circle of sevenths" (counting upo semitones from C to G).

So, the arrangement makes solid sense when applied to the human hand. We need to be able to span interesting distances with the "octave" interval be very useful for most pianists as a basic required for anyone older that 10-12. Some pianists can span 10ths with relative ease but they are in the minority. The piano music of Rachmaninoff is riddled with these massive but musically sonorus intervals. The are the major third expanded to the pure natural interval (10 keys apart) of the "bugle" overtone series.

I can reach the 10th's on the white to white instances but the black to white (Bb to D for example) are beyond me. And doing them quickly and accurately is the mark of true mastery of the instrument... it's like being able to dunk: genetics help and no amount of effort can help a small handed pianist.

share|improve this answer
    
The thing that helps a small-handed pianist is a smaller piano. There is no sense in making the instrument a standard size, and it is actually ridiculous that the keys are as big as they are in the modern age, where we can make the same percussion action with small keys, allowing for more precision. –  Ron Maimon Sep 2 '12 at 3:16
    
Given the conventional weird way of naming intervals (an interval of a single semitone or tone is called a "second", not a "first"), measuring by semitones would cause the C-G interval to be called an "eighth" rather than a "seventh". Unless of course one would take the occasion of changing terminology to do away with that weird convention once and for all. –  Marc van Leeuwen Dec 20 '12 at 8:08

I'm no musician, but as far as I know, audio waves are felt only then "round/sound", iff they repeat faster than a specific frequency. That frequency is probably that of our brain waves: being awake and in a non-meditating state, that is faster than like 18 or more Hz; neither can you shiver faster nor hear lower frequencies than your brain waves.

Audio waves have a length of $$\mathrm{lcm}\{m,n\}·2\pi$$ if they are of the shape $$a_1·\sin(m·2\pi·t+s_1)+a_2·\sin(n·2\pi·t+s_2)$$. The notes double their frequency each octave; therefore they have a logarithmic scale and not a linear. Good violin and harp players can play all fitting ("sound" sounding) combination of frequencies, but instruments with keys lack the variety.

(Qiaochu Yuan did answer faster than me, while I was on the phone. Seems to be more complete than I could have answered. I have nothing to add.)

share|improve this answer

I agree with the theory that the distinction between the notes is used for visual aid and reference points. In addition to that, it was meant to be treated as a vertically rising instrument as if you were to go up a ladder of sorts and those accidentals ( in the case of C, the black notes) are the grips to reach to the next level. As we would refer to them as leading notes. There is also another reason why there are that many notes. Almost all scales are a variation of the major scale or aeolian mode. This scale is designed to have a certain number of tones and semitones to give it the feel of a major scale. If there were too many tones or too many semitones it would not be the same because it will produce too much dissonance or invariably consonance. That is why there is a standard tuning for pianos i.e. A440. If the interval in vibration were to be changed it would not be the same because if the vibrations aren't in sync, the resonation will be totally off. That is why there can be only soo many notes on a piano and make sense to the human ear. Other tunings are possible but the same effect is made that the intervals are kept in a strict way to keep harmony. So, getting back to your question Mathematically, yes there is a reason for that specific order of white keys and black keys. Most of its relation deals with the mode theory of 12 notes and the circle of fifths where if you were to expand the notes on the piano it will form a perfect circle in diminished chords of C as the cardinal points. If you were to go in fifths in a clockwise direction the circle will be C g d A e b F#/Gb d#/db Ab Eb Bb F where when compressed into one octave it turns out with 7 natural notes and 5 accidentals

share|improve this answer

I think in a tiny tiny nutshell... the reason for the 12-division is because a very practical solution for Western music, and the layout of black/white "evolved" into this form because it lacked re-engineering.

There is no particularly "mathemagical" thing about it. In other words... square two: it's an arbitrary choice.

If you're looking for something that uses 12-divided octave as a practical solution and is engineered for facility, check out the layout of the Russian Bayan (accordion). It's pretty awesome.

As for something that is engineered for facility but does not divide the octave into 12 parts, your common fretless string instruments are good examples.

Again, all I've said has been mentioned above. Just beware of the overtly "mathemagical" ones, they don't say much about the music but rather put it in a fancy straightjacket.

share|improve this answer

If you really want to know all about it then you should read 'On the sensation of tone' by Helmholtz.

share|improve this answer
1  
Here it is in Google Books. –  J. M. Nov 26 '10 at 3:18
    
Please, Rudi, it should be Helmhol t z. :) –  Robert Filter Jan 19 '11 at 8:37

One day I shall do a serious study of this! there is truth in all these answers, the white notes give us our do-re-mi (major scale) starting on C, this scale has a mixture of tones and semitones, and dictate where the black notes should go and how many we need. The re-tuning to equal temperament is a fudge, and if you were to analyse a tuned keyboard, not all semitones are equally spaced. Other intervals are also compromised, so a major third in one key may have notes further apart than one in a different key. Composers have long been aware of this, and aware that the key they select for a composition can make a significant difference to the "mood" (that is after you have selected major or minor).

Classical Indian Music uses a system of scales (ragas). There are several hundred of these, and they will be fitted to specific moods, times of day, types of occasion etc. These are not random variations from any Western scale, and have nothing to do with the keyboards we commonly use.

Our keyboard system is just for keyboards - a string instrument may not play exactly the same pitch as a piano for a given note (unless it is an open string), because they will tend to use something closer to the original pythagorean scale.

PS I am a working musician with a bachelors degree in maths!

share|improve this answer

A somewhat grapical representation of what Carlos Ribeiro was talking about.

"If you take any note in the C major scale, you can treat that note as the start of another scale. Take for instance the fifth of C (it's the G), and build a new major scale, now starting from G instead of C. You'll get another seven notes. Some of them are also on teh scale of C; others are very close, but not exactly equal; and some fall in the middle of the notes in the scale of C. "

Note the semi-tone interval EF and BC on the C scale. When trying to reproduce the same scale starting at D, we run into a problem. Alphabetically, the third note should be a F, but F is a semitone too low for that spot. In order to maintain the same sounding scale, we need to introduce a NEW note, called F#.

  • C - D - E F - G - A - B C (C scale)
  • D - E - F#G - A - B - C#D (D scale)
  • E - F#-G#A - B - C#- D#E (E scale)
  • F - G - AA#- C - D - E F (F scale)
  • etc.
    Note that in actual writing of music the A-A# would be written as A-Bb so that the 'A' line of the staff wouldn't be ambiguous.
share|improve this answer

protected by J. M. Sep 26 '11 at 1:32

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.