Steve Engels clicks on a file on his desktop and a classical piano piece flows out of his computer’s speakers. He lets it play for a minute or so, and then clicks on a different file. After a short wait, another very similar piece begins to play, echoing but not replicating the original.
The first piece was composed by Johann Sebastian Bach. The second was composed by a computer imitating the Bach piece.
With time, a classical music aficionado would be able to detect differences between the two: the computer piece lacks an overarching structure and there’s no sense of a musical idea being developed. But it is a surprisingly good imitation – and that’s exactly what Engels, a senior lecturer in the department of computer science, and Daniel Eisner (BASc 2010) designed the program to do. “This tool allows people to find a piece of music they enjoy. They feed it into the software. It analyzes it, and generates music in the same style in real time, forever,” Engels says.
To accomplish this, the program makes a statistical analysis of the original piece of music. Then, for each note it plays, it can predict the likely value of the next note – including its pitch, duration and where it falls on the beat – and choose the next note based on those odds. That note becomes the basis for the next note, and so on until the program is stopped. Similar rules allow it to choose appropriate chords, and even to make sure two musical “voices” – equivalent to the different parts played by two hands on the piano – don’t clash.
Eisner, who plays piano, saxophone and bassoon and also composes, says that the resulting music lacks the structure that a human composer or improviser would provide. But the music retains the flavour and character of the original. So far the program has reproduced ragtime, classical, jazz and pop, and it can do it either as a solo or as an ensemble of different instruments.
The two made a presentation about the program to the Game Developers Conference in San Francisco in March, figuring it might be useful for generating background music for video games. One of its advantages is that it can segue seamlessly from one type of music to another, which would be useful when a character transitions from one part of the game to another.
Eisner says other programs have used similar methods. But all those that he’s aware of have tried to generate music by programming in higher-level concepts, such as scale and chord construction, and by using pre-set rules rather than by letting the program simply predict one note at a time. But Eisner and Engels say the simple approach seems to work best.
Eisner isn’t sure if computers will ever make music to rival human composers: Music obeys mathematical rules, which computers are good at, but music is also an emotional expression, and machines are poor at mimicking that.
Answer in the first comment, below. Don’t look!