Cantus Firmus
A crab canon is a small piece of music consisted of two copies of the same melody, each of which is the reverse of the other, stacked together—e.g. ABCD and DCBA. Have a listen at one wrote by Bach.1 It seems simple enough to write one of these, given a good melody. With minimal experimentation, though, it is easy to see that taking any well known melody of today and stacking it with its reverse likely sounds terrible. What is Bach’s magic?
First Species
To make the question more general, let’s consider what makes any music sound pleasant and interesting (here I cheat a little and use the term “any” to refer to mainstream western music and not, for example, Gagaku2). Composers exploit popular patterns and structures in music and use these as priors in their compositions (if you believe that music is some conditional generative process). These priors are baked into composers’ brains through a process called learning music theory. During this process, you often have to tolerate a guy named Tony—short, with glasses, strict, loves saying “appoggiatura”, is as serious about the correctness of the music as he is about the roundness of the earth—yelling at you.
Despite the presence of Tony, most music students still make it through learning harmony and counterpoint, the fundamentals of music theory. Bach, Mozart, Beethoven, Brahms, Prokofiev, and other famous composers all had to master the theories of harmony and counterpoint. Harmony looks at how basslines progress and how chords evolve from/to each other, while counterpoint focuses on combining multiple melodies together (polyphony) and allows you to write stuff like the crab canon.
Second Species
When first learning counterpoint, a student is provided with a cantus firmus, a monophonic “reference” melody designed to sound good by itself, and is asked to write a complementary melody against the cantus firmus. The theory of counterpoint is a collection of hard constraints in the form of “X cannot precede Y” along with softer constraints such as “contrary motion is encouraged” that the student must adhere to in this process. These constraints guide the student into a local optima of some abstract space of musical enjoyability, such that any composition of notes spun out from this neighborhood is “musical.”
The crab canon is different from species counterpoint, but most of the same constraints apply. In addition, you have to write the start and the finish of the melody simultaneously for the music to be reversible. Here, the reverse of directional constraints also have to be considered (i.e. instead of just checking A cannot precede B, we also have to check that B does not precede A). In short, Bach made the canon sound good by mostly following simple rules.
Bach is thought of as a musical genius because he is good at composing under these constraints and made significant contributions to the development of the theory of counterpoint. Concretely, this means that he is able to achieve many of the soft constraints while satisfying all the hard ones. To be honest, I have no idea if this means that he has a great intuition for music or that he is a great mathematician, because the process of navigating this constrained optimization problem is very logical (like solving a puzzle). Maybe both. This scratches the surface of the profound connection between music and math, which I may write about in the future.
Third Species
Bach left a great legacy. But music always evolves and crab canons go out of fashion. You can hardly tell that western music before3 and after4 Bach came from the same continent (actually, maybe you can). Music became more complex and, in my opinion, much more interesting. To differentiate between stages of development and styles of music, historians have characterized western classical music into different periods:
Medieval/Renaissance (Palestrina)
Baroque (Bach, Vivaldi)
Classical (Mozart, Haydn)
Romantic (Second best period: Chopin, Brahms, Beethoven, Liszt, Paganini, Tchaikovsky, Schumann, Berlioz, Wagner, etc.)
20th Century (Objectively the best period: Ravel, Rachmaninoff, Prokofiev, Sibelius, Shostakovich, Stravinsky, Debussy, Ligeti, etc.)
The evolution of western classical music was driven by both innovations in hardware (new instruments and bigger orchestra) and software (music theory). Better hardware provided the materials needed to craft more interesting music. For example, the piano was originally called the fortepiano (Italian: forte - strong; piano - soft/quiet) because of its groundbreaking ability to play a range of dynamics.
Developments in music theory are less direct. Music theory can be thought of as a generalized version of counterpoint: a set of constraints and guidelines that most popular composers follow. They are usually about breaking rules and making new ones. For example, harmony started with mostly staying within the original key (diatonic), sounding consonant yet bland. Then, composers added non-diatonic chords from closely related keys and even occasionally modulated to these related keys. Then, they introduced more chromaticism by modulating to more distant keys and tolerated a lot of dissonance. Then, the 20th century people came and did stuff I don’t understand but the music sounded even better.567
After 20th century, music blossomed in the west. Instead of having one school dominating mainstream music, there are many different popular genres of music today. However, today’s music is a lot simpler from the music theory perspective described above, partially because songs are shorter and instrumentations are simpler. So please allow me to be a little snobbish and claim that classical music has more endurance when it comes to repetitive listening because you can always find something new in them. What saves the day for pop songs in gaining Arthur’s admiration is the combination of lyrics, which add a new dimension of enjoyment, with interesting melodies.8
Fourth Species
To conclude, I want to go back to Bach and discuss the differences between creating art and viewing art. Let’s rid Bach of any emotions, subjectivity, and agency, and consider him as some computer program that samples from the distribution of all possible music, conditioned on the rules of counterpoint and harmony, denoted as P. We can also characterize the music that I personally resonate with as some other distribution Q. In this formulation, I would resonate with music sampled by Bach if it has high density in my personal distribution Q. In general, counterpoint and harmony should be a good heuristic9 to minimize the KL divergence between P and Q. If I were viewing this as a machine learning problem, I would use a preference model to approximate the distribution Q while using a generative model to parametrize Bach.
This is not what I want to believe. I want to know why music generated from objective, simple rules such as “X cannot precede Y” can elicit intense emotions. I want to believe that Bach is trying to communicate with me through his conscious choices in navigating the space of all possible music and that I can hear him. I also find it uncomfortable that my own emotional space can be characterized by some probability distribution. Rationally, I am skeptical that my feelings have any resemblance to the meanings that composers encoded in the music beyond general descriptors like sad, happy, and solemn. In this sense, I am attributing meaning to objects. Maybe this is the value of art: not to allow any communication, but to provide a space for creativity where you let your subjectivity dominate, attribute meanings to objects, and exploit these meanings and stories for pleasure.
This still sounds a lot better than P and Q.
Fifth Species
“The brain is locked in total darkness, of course, children, says the voice. It floats in a clear liquid inside the skull, never in the light. And yet the world it constructs in the mind is full of light. It brims with color and movement. So how, children, does the brain, which lives without a spark of light, build for us a world full of light?”
― Anthony Doerr, All the Light We Cannot See
Crab canon on a mobius strip. (Note: if you have perfect pitch, like me :), you will see that the notes played is a major third lower than what’s written due to different pitch standard in baroque era.)
e.g. Palestrina.
e.g. Zimerman plays the coda section of Chopin’s Ballade No. 4 (amazing performance of the most technically difficult parts in regular piano repertoire).
e.g. Vengerov/Barenboim Sibelius Violin Concerto, lyrical part of movement 1
e.g. Sokolov Rachmaninov Piano Concerto No. 2, ending of Movement 3, triumphant moment; the entire concerto is a tribute to his doctor after recovering from depression/writer’s block, written when he was around my age.
Ah, Heuristica.