I know that the white keys on a keyboard form a diatonic scale, but what does diatonic really mean?
SOS Contributor Len Sasso replies: To understand the meaning of diatonic, it helps to think of a scale not as a collection of notes, but rather as a series of intervals. The definition of a diatonic scale is that there are five whole-tone and two semitone intervals in the series and that the semitones must always be separated by at least two whole-tones. Using '2' to symbolize the whole-tone steps and '1' for the semitone steps, the major diatonic scale corresponds to the interval series 2212221. No matter what note you start on, following this prescription yields a major diatonic scale — the white keys starting on C is one example. It turns out that all possible diatonic scales are constructed by starting somewhere in the major diatonic scale and continuing until you reach the same note you started on. Those are generally referred to as the church modes: Dorian for 2122212, Phrygian for 1222122, Lydian for 2221221, and so on.
While the preceding definition is correct and functionally useful, it might leave you a little cold, as it does nothing to explain why those intervals are used or why the seven notes in a diatonic scale are chosen over the other notes in the 12-tone equal-tempered scale.
For reasons deriving from the physics and maths of sound, the strongest harmonic relationship aside from the octave is the perfect fifth, which makes G the closest relative of C, for example. Since C stands in the same relationship to F as G does to C, it makes sense that a scale centered around C should contain both G (called the dominant) and F (called the subdominant). The next closest harmonic interval is the major third. Together, the root, major third, and perfect fifth constitute a major triad, and it's not too big a stretch to imagine that you might want to construct a major triad on the three notes C, F, and G. Do that and you have the seven notes in the C diatonic scale.
There's still the question of why there are five other notes in the 12-tone equal-tempered scale, and the answer contains a hidden but important compromise. You can make music, which is naturally called diatonic music, with just the seven notes of the diatonic scale. And if you did that, they would in fact be slightly different notes from the ones you find in the equal-tempered scale. If you want to expand the system to accommodate diatonic scales in other keys, one natural way is to iterate the process of adding perfect fifths. This produces what is commonly called the 'cycle of fifths', but is actually a spiral of fifths that never really comes full circle. But if you make the perfect fifths just slightly flat, they do come full circle after 12 steps. Miraculously, you also wind up with notes that are close to the major thirds — they're a little sharp and a little more out of tune than the fifths, but still usable.
This compromise gives us the 12-tone equal-tempered scale (equal-tempered meaning all the intervals are the same). Relative to C, the extra five notes turn out to be where you find the black keys on the piano keyboard, and that's why the intervalic definition we started with works.