7 white notes and 5 black - why are keyboards the way they are?
Posted: 28 April 2023
Revised: 16 May 2023
Copyright © C E Pykett
Abstract. This article charts the history of the keyboard from ancient Greece to modern times. It explains how the seven-note Pythagorean scale was developed from only three purely-tuned intervals - the fourth, fifth and octave - using a number system strongly imbued with religious mysticism, and how these notes still exist as the white notes of today's keyboard. For centuries the same notes were associated with the ecclesiastical modes of plainsong until they were augmented in medieval times by five additional black ones. These also remain unchanged today in the familiar alternating groups of two black notes followed by three, and together the white and black notes formed a fully chromatic octave of twelve semitones. Firstly in medieval Europe, this subdivided octave enabled musicians to explore the concept of 'key' as well as 'mode' together with the system which led to Western harmony built on the basis of 12 major and 12 minor triads with their major and minor thirds. Along with the many different keys came the ability to modulate from one to another, hitherto unknown. The expanded keyboard was backwards-compatible in that it still enabled the old modes to be played on the white notes only, together with the new set of 24 keys using both the white and black notes. The story is remarkable in that it hinges so strongly on the Greeks' mystical notions of numerology. It is therefore arguable that we might not have the music we enjoy today, nor the keyboard which often generates it, without the religious notions of the ancient Greeks and their gods. It is also remarkable that beautiful keyboards virtually identical to those of today were in use in Europe well before 1500.
(click on the headings below to access the desired section)
Have you ever wondered why the keyboards we use today are as they are, with seven white notes and five black ones to the octave?  And why are the black notes arranged in those alternate groups of two and three? Has anyone asked you to explain it, and could you answer them if they did? If you ask these questions of Google you get a wide variety of answers, ranging from the beguilingly simple one that performers would not know where to place their fingers if all the notes looked the same, to reams of unintelligible mathematical rigmarole. In fact the answer lies somewhere between these extremes, though with some uncertainty due to the web of myth and legend overlaid on a tenuous historical framework going back thousands of years. This article positions an explanation against this background without calling on anything beyond the simplest maths, physics and musicology, and avoiding the historical cul-de-sacs often found elsewhere.
Much of the received wisdom of the subject is illusory in the sense that it has been invented to fill the many historical gaps. Pythagoras (c. 570 - c. 490 BCE) is frequently invoked at an early stage in discussions of this kind, yet one only has to review the scant evidence about his life and works to realise this. For instance, he was not the first to discover his eponymous theorem about right-angled triangles, and there is no evidence that he rediscovered it for himself. Self-evidently, the theorem was obviously well known thousands of years earlier to those who built structures such as pyramids - if you can't lay out right angles on your building site you can't call yourself a builder. Furthermore, Pythagoras and his secretive disciples revealed little or nothing of what they actually did. So although some of what we need here arose in ancient Greece, it is misguided to focus too strongly on one man.
Moreover, although the Greeks used a decimal numbering system based on ten as we do today, their mathematics was founded at least as strongly on geometry (lines, shapes, areas and volumes) as on numbers. There was nothing wrong with this per se, and Einstein himself was by inclination a geometer. But for the Greeks, geometry was rather forced on them because they had no abstract notion of zero. It seems strange that they could not write down the number of no olives or apples, considering their achievements in other aspects of logic and philosophy. Thus their arithmetic was restricted by having no symbol denoting nothingness, this vitally important ability only arising centuries later. Consequently their study of numbers lay closer to numerology with its mystical connotations than to the mathematics we are familiar with. In particular, the Greeks saw purity and a route to the divine in small whole numbers and the fractions or ratios which used them. The sequence 1, 2, 3 and 4 was particularly revered because the numbers added up to 10, and we shall return to this later.
The Greeks did, however, lay the foundations of today's music in other ways. As with Pythagoras, much of the detail here is difficult to pin down, but overall there is little doubt that Greece at that time nurtured the beginnings of what we would call musical acoustics. They used it to invent new musical instruments, and once they had them, they were able to formulate rules for making euphonious music which led very much later to the sophistication of Western harmony among other things. Along the way a convenient means of playing several notes at once (intervals and chords) became necessary, since harmony as we know it is based on triads (at least in the Western common-practice era), and in turn this led to today's keyboard. So, in a nutshell, the previous few sentences answer the question of how our keyboard arose. But further explanation requires further discussion which now follows, together with a more detailed but still succinct answer to the question in the summary section.
However, before examining these two strands of mathematics and musical acoustics in a little more detail, a third aspect needs to be mentioned briefly. It is the issue of what has driven the evolution of music in the first place. Put another way, it is interesting to contemplate why the human brain finds music attractive. It is singular that various cultures over the ages have arrived independently at similar musical scales from which they derived the successive notes of melody and the simultaneous notes of harmony. Although these are not matters which can be taken further here, there is presumably some deep connection between psychology and neurology and the structure of today's ubiquitous keyboard. A particularly fascinating aspect is that musical intervals whose frequencies have simple integer ratios are mainly involved in the formulation of the scales we play on keyboards, and this remarkable fact was discovered and built on by the ancient Greeks as we shall now see.
The Greeks experimented with vibrating strings to deduce relationships between string length and musical pitch, and in particular they discovered how to shorten or lengthen strings by amounts which produced desirable (consonant) musical intervals. By stopping a string in the middle, the vibrating part of the string is now only half as long and it sounds the octave. Thus there is a ratio of 2:1 between the two string lengths giving the interval of an octave. Another important interval is the fifth, which requires the ratio of 3:2 in terms of the lengths of the strings required to generate it. Yet another is the fourth with a ratio of 4:3. These three ratios of 2:1, 3:2 and 4:3 were seized on by the Greeks as having mystical properties because they accorded with their liking for simple small-integer relationships. They were probably driven by the mystical numerological imperative which said that 1 + 2 + 3 + 4 equals 10, thus it is probably no coincidence that all four numbers were included in the three interval ratios mentioned. Another attribute which might have fascinated them is that the digits forming each ratio differ by one from the next. Thus 2:1 becomes 3:2 by adding one to each digit, with the same applying to the pair 3:2 and 4:3.
Irrespective of the mystic aspects, a remarkable practical outcome was that only these three intervals were sufficient to generate all the other notes of a complete musical scale. For example, starting at C, the intervals immediately gave notes at C an octave higher together with F (the fourth above C) and G (the fifth above C). A new note, D, was then generated by descending a fourth from G using the relation 3/2 x 3/4 = 9/8 . This says that G, the fifth from C (obtained using the ratio 3:2 or the fraction 3/2), has to be reduced in frequency by 3/4. This is because an ascending fourth increases the frequency by 4/3 whereas for a descending fourth the ratio is inverted to 3/4, thus reducing the frequency. The fraction 9/8 which results means that the two string lengths of the interval C to D in this scale are in the ratio 9:8.
By using repeated and similar mathematical reasoning to that above the Greeks went on to show that a complete diatonic octave of notes, a scale, could be constructed. But as remarked above, they did it using only the intervals (ratios) of the octave (2:1), the fifth (3:2) and the fourth (4:3). Thus, and to repeat, you can see that only the numbers 1, 2, 3 and 4 were needed to produce all the notes of the diatonic scale. Eight notes were generated by this process including those at the start and end, hence the name 'octave', and the resulting scale became known thereafter as the Pythagorean scale for the flimsiest of historical reasons. It still occupies the (usually) white notes of each octave on a modern keyboard today.
It is worth looking at the Pythagorean scale in a little more detail. As noted above, it is the diatonic scale starting at C on a modern keyboard and it employs only the white notes. In other words it is the scale of C major in today's parlance. Looking at the intervals between each pair of notes, they generate the following sequence across the octave:
T - T - S - T - T - T - S
'T' denotes a whole tone and 'S' a semitone or half-tone. This means that the intervals or frequency ratios between each pair of notes are not all the same size. Consequently, if one plays a scale (on the white notes only) starting at D instead of C, one gets a different sequence of tones and semitones, and the music that results will therefore sound different. This is the basis of the modal music used for centuries thereafter. Because there are seven different starting notes there are seven modes which attracted names such as the Ionian mode which starts on C. In our terminology the Ionian mode is the same as C major.
Modes held sway for a long time until, for some reason, the Europeans suddenly decided (in the medieval era between c. 1000 and c. 1400 CE) they wanted something more. Modes had hitherto restricted ecclesiastical music-making to the motion of parallel parts separated by octaves, fifths and fourths in plainsong. But then musicians began experimenting with tonal constructs such as triads which included the interval of a major or minor third, requiring additional notes which could not be played using the Pythagorean scale even though expert singers could sing them. This is because these extra notes did not physically exist on a collection of only seven white keys to each octave (eight if you count the top note as well). So the simple fact is that the keyboard had to be expanded to include additional notes, each one lying between the pair of white notes previously separated by a whole tone denoted by 'T' in the sequence above. Since there are five T's, there had to be an additional five notes, each giving the interval of a semitone from its neighbours. These five additional notes became the five (usually) black keys on our modern keyboard. The alternate grouping of two black notes followed by three is revealed by the similar grouping of the T's - the whole tones - in the much earlier Pythagorean scale, resulting in this same conspicuous yet familiar feature which still graces our keyboards today. When we see it, we are transported directly back to ancient Greece and the positions of the whole tones to remind us of those in the Pythagorean scale.
So the expanded keyboard now had 12 notes to each chromatic octave instead of the seven of the diatonic octave, each note separated from its neighbours by a semitone up or down. A clever aspect of the arrangement was that the new keyboard was backwards-compatible with the old since the modes were still catered for by the white notes. Equally clever was the fact that its designers were canny enough to realise that it's much easier to foist something new on people if they don't immediately lose what they were used to. Also the new concept of 'key' was ushered in with the new arrangement. Keyboard music could now be played in 24 keys, 12 major and 12 minor, and it enabled the development of harmony, modulation and the other ingredients which have contributed to the Western musical culture we have since enjoyed. In Europe, beautiful and delicate keyboards virtually identical to those we use today were in use well before 1500 .
The subject of temperament (various mathematical recipes for tuning the notes) utterly distorts the details of the simple picture painted above, though it does not affect the story of how the modern keyboard evolved. Thus far I have deliberately kept things simple to avoid putting readers off by introducing unnecessary complication. However it is worth mentioning that the purity and intellectual beauty of the integer-based mathematics so beloved of the Greeks did not survive the introduction of black notes in medieval times. This is because the tuning of some intervals across the keyboard necessarily became impure and it has remained so ever since. With five additional notes crammed into the octave it was found that some or all of the twelve semitones had to be detuned from the values the Greeks had calculated, otherwise the octaves themselves would have become impure and this would have led to anarchy among singers and players. This is not the place for a detailed discussion of temperament as, like philosophy and theology, it is one of those subjects deliberately formulated to never reach closure, having underwritten the salaries and pensions of countless academics for centuries past. However if you want to appreciate the problem at first hand, choose a keyboard instrument which has been tuned to A440 in equal temperament (most of them are) and play the fifth between treble C and the G above at 8 foot pitch. If the tuning is accurate you will hear a slow beat at about 1.8 Hz between the notes (nearly two beats per second), indicating that they are not exactly in tune. Unfortunately this detuning is both deliberate and necessary. All other temperaments exhibit the same problem, if not with this particular interval, then with others. All temperaments have some intervals which are far worse than this - even in equal temperament the thirds sound pretty rough, and that's before you come up against the unusable Wolf intervals of meantone tuning.
There is only one way to get round the problems of temperament and that is to provide many more notes to the octave. Unfortunately you would then have to play on a different set of notes depending on the key you were currently using. Since this verges on the ridiculous, perhaps it explains why the vast majority of musicians today show little concern for temperament. One can reasonably reach this conclusion given that our current keyboard has been around, unchanged, for so many centuries. So most practical musicians seem to just shrug off the downsides and live with it. This widespread indifference might explain why some of today's advocates of temperamental change can get so bad-tempered .
The Pythagorean scale (or its close relative, the Just scale) was all that was required throughout the long era of modal music. Problems of temperament were unknown since there was no concept of 'key' and therefore of modulation into different keys. So when the black notes came along, Pythagoras must have turned in his grave.
1. The numbers 1, 2, 3 and 4 were especially favoured in ancient Greece because they add up to ten, the basis of the Grecian decimal numbering system. Thus they were regarded as mystical and were embedded in the close embrace between the Greeks' mathematics and their religious beliefs.
2. By stopping a string at its centre, it was found that the vibrating part of the string was only half as long and it sounded the octave, the vibrating part having a length one half of the total string length. Thus the whole string and the shorter vibrating part had a length ratio (and therefore a frequency ratio) of 2:1. Other important ratios were 3:2 for the interval of a fifth and 4:3 for a fourth. These three length ratios were seized on by the Greeks as having mystical properties because they accorded with their liking for simple small-integer relationships. Note that the three ratios incorporated all of their particularly important numbers 1, 2, 3 and 4.
3. Using only these three ratios corresponding to the intervals of an octave, fourth and fifth the Greeks generated a complete musical scale of eight notes (counting the octave itself) using simple mathematics. This became known as the Pythagorean scale. It consisted of a particular sequence of whole tones and semitones, and it gave rise to the white notes of the modern keyboard. These notes were used for centuries to derive the various modes used for plainchant, each mode depending on which starting note was used.
4. In medieval times European musicians began to look for more flexibility in terms of the number of different intervals they could use. They introduced the concept of 'key' in addition to 'mode', together with the system which led to Western harmony built on the basis of 12 major and 12 minor triads with their major and minor thirds in all 24 keys. Along with the many different keys came the ability to modulate from one to another, hitherto unknown.
5. But the need to play intervals, triads and other chords in all keys required additional notes on the keyboard. Each of the five whole tones of the Pythagorean scale was therefore split into two semitones so that the octave was now spanned by twelve semitones. Thus five new notes per octave were added to the keyboard, and these became our black notes. Because of the grouping of the whole tones in the Pythagorean scale (two followed by three with a semitone between), we get the same familiar repeated pattern seen on modern keyboards of two black notes followed by three.
6. The expanded keyboard was backwards compatible in that it still enabled the old modes to be played on the white notes only, together with a new set of 12 major and 12 minor keys using both the white and black notes.
7. The story is remarkable in that it hinges strongly on the Greeks' mystical notions of numerology. It is therefore arguable that we might not have the music we enjoy today, nor the keyboard which often generates it, without the religious notions of the ancient Greeks and their gods. It is also remarkable that keyboards virtually identical to those of today were in use in Europe well before 1500.
2. 3/2 x 3/4 = 9/8 is an equation (mathematically speaking it's an identity), but the ancient Greeks would not have written it like this or at all. They would have represented it geometrically by drawing lines of various lengths to scale on a diagram, since equations using algebra as we know it were not invented until much later. However, drawing lines was actually better matched than algebra to the problem in hand since the lines would have represented directly the actual string lengths under investigation.
For example, see the 15th century positive organ pictured in the Trinity altarpiece of the former Collegiate Chapel at Holyrood Palace in Edinburgh, Scotland by Hugo van der Goes
4. The author of a widely-quoted book on temperament, Charles Padgham, used the phrase "conservatism, fear of the unknown and ignorance" in relation to those whom he saw as unconverted to his views. Such irrational zealotry is common in the literature on temperament.
See "The well-tempered organ", Charles Padgham, Oxford 1986.
Unfortunately for Padgham, he rather hoist himself by his own petard through the innumerable mathematical errors in his work. I corrected those I had come across by the time of writing an article elsewhere on this website at:
Padgham's 'Well-Tempered Organ', C E Pykett, 2013
it is suggested that Padgham's book should be used with caution.