Tonal music is written in keys, that is, establishing the starting point for the tones that make up the major and minor scales. Any tone can be that starting point and therefore a key. That means that there are twelve major and twelve minor keys from which to choose. It’s also arguable that there are seven more keys possible if one assumes that enharmonic equivalents are actually different tones. On keyboard instruments such as the piano, the tone F-sharp is the same as G-flat. But on other instruments, it’s possible to make F-sharp higher than G-flat. That allows for another seven keys.
Then there’s rhythm, the amount of time devoted to each note. In western music, rhythmic patterns are defined by beats and a brief time period called a “measure” which in most music is two, three, four, or, occasionally, five beats long. The beats themselves can be subdivided into two or three sub-beats. In complex music, composers sometimes write melodies or harmonies with two different rhythmic patterns sounding at the same time.
Tonal music reaches its artistic apex in counterpoint or polyphony, the sounding of multiple melodies at the same time. Melodies in counterpoint must be individually satisfying and go together in ways that adhere to the rules of harmony to be pleasing to the human ear. That makes composing them mammothly difficult.
Counterpoint’s most celebrated form is the fugue which sets a single melody against itself. The best known fugues are those in Johann Sebastian Bach’s Das Wohltemperierte Klavier (The Well Tempered Klavier), a collection of 48 preludes and fugues. In the view of many, myself included, Bach’s fugues are the highpoint of tonal music.