Enter the maze

Composing from Compression

by Geraint Wiggins, Queen Mary University of London

Music in the Head: copyright istock.com 18584505

Computers compress files to save space. But it also allows them to create music!

Music is special. It's one of the things, like language, that makes us human, separating us from animals. It's also special as art, because it doesn't exist as an object in the world - it depends on human memory. "But what about CDs? They're objects in the world", you might say and you'd be right, but the CD is not the music. The CD contains data files of numbers. Those numbers are translated by electronics into the movements in a loudspeaker, to create sound waves. Even the sound waves aren't music! They only become music when a human hears them, because understanding music is about noticing repetition, variation and development in its structure. That's why songs have verses and choruses: so we can find a starting point to understand its structure. In fact, we're so good at understanding musical structure, we don't even notice we're doing it. What's more, music affects us emotionally: we get excited (using the same chemicals that get us excited when we're in love or ready to flee danger) when we hear the anthem section of a trance track, or recognise the big theme returning at the end of a symphony.

Surprisingly, brains seem to understand musical structure in a way that's like the algorithms computer scientists use to compress data. It's better to store data compressed than uncompressed, because it takes less storage space. We think that's why brains do it too.

Even more surprisingly, brains also seem to be able to learn the best way to store compressed music data. Computers use bits as their basic storage unit, but we can make groups of bits work like other things (numbers, words, pictures, angry birds...); brains seem to do something similar. For example, pitch (high vs. low notes) in sequence is an important part of music: we build melodies by lining up notes of different pitch one after the other. As we learn to hear music (starting before birth, and continuing throughout life), we learn to remember pitch in ever more efficient ways, giving our compression algorithms better and better chances to compress well. And so we remember music better.

Sound waves only become music when a human hears them

Our team use compression algorithms to understand how music works in the human mind. We have discovered that, when our programs compress music, they can sometimes predict musical structures, even if neither they nor a human have "heard" them before. To compress something, you find large sections of repeated data and replace each with a label saying "this is one of those". It's like labelling a book with its title: if you've read Lord of the Rings, when I say the title you know what I mean without me telling the story. If we do this to the internal structure of music, there are little repetitions everywhere, and the order that they appear is what makes up the music's structure.

If we compress music, but then decompress it in a different way, we can get a new piece of music in a similar style or genre. We have evidence that human composers do that too!

What our programs are doing is learning to create new music. There's a long way to go before they produce music you'll want to dance to - but we're getting there!