# Repetition in Music

This is a simple demonstration of how repetition creates music. Most musicians know this already, at least ones who improvise. The saying goes, "if you make a mistake, simply make it four times in a row and it's not a mistake anymore". Let's start with music generated randomly. The music is not wholly random. Instead notes were chosen from the C-major scale with different probabilities for each note. For example, the "C" was more probable than the "A". The probabilities come from an empirical distribution collected on a corpus of Bach compositions but I don't remember anymore exactly which ones, or where I got them. Only quarter notes and eighth notes were used, with quarter notes having a higher probability than eighth notes. Finally, no note duration could cross over a measure marker (i.e. no ties were allowed). First listen to the random music [midi wav] shown in the score below.

Now let's look only at the repeated phrase. It is made up from bars marked A and B. When you listen to the repeated random music [midi wav], you may hear something different. When I listen to it, I perceive structured music as opposed to drifting "elevator melody".

Finally let's take our "composition" and mark the repetition boundaries using modulation . We will play the phrase twice, then modulate it up to the major fourth (thus making a common chord change for popular music) and play it once. Then we'll return to the tonic (modulating back down a fourth) and repeat again. In the version [midi wav], I add a bass line that marks the modulation. Thus the bass line goes from C to F and back to C. This is just for fun.

Analysis: There's nothing new here! It's commonly accepted as far as I know that this kind of repetition will create the sense of musical structure. We've simply created enough structure for expectancies to be created and met. By adding modulation we get surprise (well, not too much surprise...) Why is this interesting? The repeated values are perfectly correlated with their counterparts four measures (32 eighth notes!) in the past. When we use modulation, the correlation is still there, but it's now "filtered" through the modulation. I think it's fascinating that even simple children's music such as nursery rhymes and jump-rope songs are full of this kind of repetition. I also think it's fascinating that many statistical learning models such as recurrent neural networks find this task to be very hard.

I'm interested in any feedback. Send email to umontreal.ca@douglas.eck (but reverse things first so my name comes before my affiliation, unless you are a spam robot, in which case leave it as it is).