Some of the answers above might not give you the whole picture. So this isn’t ELI5 but it’s more complete:
Keyboard instruments were originally designed around what’s called the diatonic scale. Others have tried to describe this scale to you. The reasons we use this scale are somewhat conjectural; we know the ancient Greeks invented it, and we know how and why it works, but we don’t know exactly how they discovered it or why they stuck with it versus other systems (of which there are many). The most common explanation is attributed to Pythagoras, who described pitch relationships as ratios. If you pluck a string, and then pluck a string half that length, the notes sound the same (an octave, or C to C as an example). If you pluck a string and then pluck a string 2/3rds as long, you get what sounds like a fifth (C to G). If you pluck a string and then ADD a third to it, you get another fifth but lowered (C to F below). You’ve now got the notes C, F, and G. The distance from C up to F is the same as the distance from G up to C. From there it’s conjecture how the Greeks decided to fill in the gaps between each of those notes, but they landed on two notes in between each pairing (C D E F, and then G A B C). The most common theory is if you keep playing notes a fifth away you get all the notes of the scale (C G D A E B F). You’ll notice the distance between each of those notes is analogous between both pairings (C to D is the same distance as G to A and so on). The distance between E and F and B and C is acoustically and aurally closer than the other distances (what we now call a half step). These two groups made up the fundamental groupings of the diatonic scale in Greek music, what we now call tetrachords.
From the ancient Greeks up through the late Middle Ages, most western music used these two groupings of tetrachords, or as we call it now the diatonic scale. Early keyboard instruments used it as well, and didn’t have anything resembling black keys… every key was ostensibly a diatonic note. But something changed in the late Middle Ages… formal music transitioned from tuning things based on the interval of a fifth, and instead moved to the interval of third. Well, that posed a problem. In the diatonic scale, the fifth of every note is somewhere in the scale. But that’s not the case with the thirds. The third between C and E sounds different than the third between D and F. So composers and keyboard makers had to insert half step notes in between to be able to play these new intervals, which resulted in the addition of F#, G#, and C# (D# didn’t come along until much later for reasons related to the weirdness of B and it’s a whole other thing). But still keyboard makers added these as white notes, not separated black notes.
The final step came with the rise of tonal music and instruments. Until the Baroque, formal music was based heavily around the human voice. Instruments were crude and expensive and in some cases even banned from churches. Since Chant used the diatonic scale, the music of the renaissance was based on this scale and used modes to unify different parts… our modern concept of a “key” didn’t exist. This meant you got the sound you wanted from centering your melody around a certain note of the diatonic scale, rather than the distances between each degree in the scale. But the movement toward intervals of thirds created a distinctive sound created by what we now term “half steps” that wanted to lead to other notes, creating tonal music and the concept of a modern “key.” At around the same time, instrumental music started to come into its own and the forerunner of the modern orchestra began to develop. But instruments play best in certain keys only (horn in F, for example, before the invention of modern valves). This meant that if a keyboard player wanted to play with a horn player, they had to be able to center around F but still play in the major or minor “key” that the horn player was using. So they had to invent a way to create the same pattern of whole and half steps of that “key” no matter what note you started on. All the other sharps and flats were born.
This created so many keys they had to start separating them into black and white. Why didn’t they alternate black white black white the whole way (so that F, G , A and B were black notes)? It’s visually confusing: there are no landmarks to guide you. So they broke it into groups of two then three black notes alternating, and coincidentally kept the original diatonic scale intact on the white notes. The original half steps naturally present in the diatonic scale didn’t get the black note half step treatment the other notes got.
Latest Answers