# The Melody Triangle: surprising music

Humans quite like surprises, nice ones at least. We go to lots of effort to make birthday presents a surprise. The best jokes work because their punch lines surprise us and the greatest magic tricks are most magical when something we didn't expect happens at the end. So does the same apply to music? Do we prefer music that is surprising and if so which ways make the nicest surprises? Can we compose interesting music based on its predictability?

Researchers at Queen Mary, University of London have been exploring the links between surprise and music. In particular they have been looking at how one of the most important theories of the information age, Claude Shannon's information theory, can be used to help make music.

Information theory dates back to the 1940s and gives a way to measure information. It was originally invented to explore questions like: how far can we shrink down a message and still restore the original? Being able to shrink data and then get it back is important for doing things like downloading movies quickly. The more the movie can be compressed the quicker it can be downloaded. Information, movies included, is stored in computers as sequences of 1s and 0s. A single piece of information that could be 1 or 0 is called a bit. Information theory boils down to a question of how many bits do you really need to store a piece of information. It turns out that is the same as asking how uncertain a prediction is ... and that is linked to how surprising something is.

A key idea of information theory is 'entropy'. It's a way of actually putting a number to how certain a prediction is. If a gambler predicts the toss of a coin, he is choosing one of only two equally likely possibilities: the entropy is low. If he were to predict the top card of a shuffled pack of cards he is less certain of the prediction, now choosing one of 52 possibilities: the entropy is higher. Predicting the next character in a message can also be measured in terms of entropy, as can predicting what comes next in a piece of music.

That's where the Queen Mary project comes in. They are exploring what information theory can tell us about how people listen to music. They are studying several different kinds of predictability, and so potential surprise, in musical patterns: how we perceive them, and how they shape our experience listening to music. If the music is very easy to predict after a short period of listening, are we more likely to find it boring? If the notes that come next are more surprising will we find it more interesting?

How entropy changes through a piece of music is one kind of predictability they are looking at. Another is 'redundancy' - is the same information available throughout the music. The more redundancy the more that long sequences of notes repeat. A third kind of predictability they consider is about how our uncertainty about the music remaining changes as we hear more music.

They have created a way for non-musicians to make music based on these ideas. Their 'Melody Triangle' randomly generates new pieces of music given values for the different kinds of predictability. Different points on the triangle correspond to the different values of predictability. For example, one corner of the triangle is maximum repetition - a single note repeating over and over. Another corner represents noise - where the next note is completely random and cannot be predicted - there is maximum entropy. The final corner represents periodic music where longer series of notes are repeated - maximum redundancy. Points in the middle of the triangle represent trade-offs between those extremes.

You can compose melodies by moving tokens around the melody triangle. By adding different tokens you can combine piano, drums and bass, as well as different rhythms to make novel, interesting musical textures. There is an Android mobile phone app version you can download and try yourself, and the team also created a Kinect version where different people became the tokens themselves, making interweaving melodies and changing them as they move around a triangle on the floor, and where arm signals change the tempo or instrument.

The team have gathered some initial feedback from people using the Kinect version of the Melody Triangle. It suggests it could be useful as a performance tool or composition aid perhaps as an idea generator. They are now using it to explore our attitudes to surprising music. It shouldn't be a surprise that a key theory about information that is more than a half a century old is driving new music research. That is the way research works.