Three disciplines have dominated my life: music, languages, and writing. The underlying logic of each is internal to the discipline and does not apply to any other. And the logics of other disciplines don’t apply to these three.
The logic of western tonal music—the only system I know although there are probably a dozen others—depends entirely on what pleases the mind of the listener. Melodies must be individual and readily recognizable. They are divided into phrases whose length is determined by how much breath would be required to sing them. The number of phrases in a given melody varies, but the most commonly there are three or four, sometimes with repeats, before moving on to a new section. How many sections a melody may have is equally variable, but most have three or four. After it is sounded once in its entirety, a melody may then be repeated or a new melody may be introduced before the first melody is repeated.
The rules for tonal harmony, the simultaneous sounding of notes, are entirely different. Standard harmony is based triads, three notes sounded simultaneous. The “root” of each triad—the bottom tone—is one of the seven tones that make up the major or minor scale. Rules, based on what composers have actually done, on the order in which triads can be heard and which one begins and ends a musical section are quite strict but are often violated for creative reason.
Rules for rhythm are mostly determined by whether the underlying pulse of a piece is to be two, three, or four beats. A march is always set in four-beat rhythm; a waltz is always in three-beat.
Then there’s counterpoint, sometimes called polyphony, the playing or singing of two or more melodies at the same time. The classic rules of counterpoint, established by J.S. Bach and his contemporaries and predecessors, are complex and strict. They apply to all western music, even to pieces made up of chords with a single melody. Unlike the rules for harmony, counterpoint rules are infrequently ignored except for special effects.