Google+

BBC Future

In Depth

Artificial music: The computers that create melodies

About the author

Philip is a writer based in London. He writes on all areas of the sciences and its interactions with art and wider culture. He was previously an editor for the science journal Nature for two decades and is the author of many books on science, including The Self-Made Tapestry: Pattern Formation in Nature, H2O: A Biography of Water, Critical Mass (winner of the 2005 Aventis Prize for Science Books), and The Music Instinct. You can find out more at his website or blog.

Can computers compose beautiful, emotional music? Philip Ball discovers a new algorithmic composer challenging our ideas of what music itself should be.

When Peter Russell first heard the unusual music, he was pleasantly surprised. It was a “delightful piece of chamber music”, he wrote, reminiscent of French pieces written in the early 20th Century. “After repeated hearings, I came to like it.”

What Russell, a musicologist, didn’t know was that the score titled Hello World had actually been composed much more recently by a computer called Iamus. Other listeners in blind tests have been similarly fooled. (Why not listen to it yourself as you read this article?)

Iamus is the creation of computer scientist Francisco Vico and his collaborators at the University of Malaga in Spain. It also has a younger sibling, called Melomics109, which composes ‘popular’ music.

You might think that any serious composers would turn up their noses at music made by a computer algorithm. But a few are already taking Iamus’s ideas very seriously. In 2012, a CD showcasing Iamus’s compositions featured performances by some of the world’s top musicians, including the London Symphony Orchestra. One of the other musicians to appear on the recording was Gustavo Diaz-Jerez, a composer and concert pianist at the Centro Superior de Música del País Vasco, in Spain, who is even using Iamus to write an opera that premieres next year.

No previous attempts to make music by computer – and there have been many, dating back to the early days of computation – have been afforded such serious attention.

A track by Melonics109

Even a cursory listen to Iamus is likely to persuade sceptics that it has come a long way from earlier efforts at computer-composed music such as “Emily Howell”, a program devised by American music professor David Cope. The key to Iamus’s success is an algorithm that mimics the process of natural selection. It takes a fragment of music (itself generated at random), of any length, and mutates it. Each mutation is assessed to see whether it conforms to particular rules – some generic, such as that the notes have to be playable on the instrument in question, others genre-specific, so that features like the melodies and harmonies fit with what is typical for that style. Little by little, the initial random fragment becomes more and more like real music, and the ‘evolutionary process’ stops when all the rules are met. In this way, hundreds of variants can be generated from the same starting material.

In a sense, these algorithms are not doing anything so very different from the way composers have always composed. Composing fugues, for example – which has been done from the Baroque to the modern era – involves taking a small melodic idea and applying permutations and rules that extend, develop and interweave it in overlapping voices, while preserving some basic and essential rules of harmony. Forms such as sonatas and concertos were also structured by clear rules.

Alphard, by Iamus, on the clarinet

Iamus’s key works so far won’t be to everyone’s taste. They are in the atonal modernist style that many people find austere and forbidding – think Birtwistle and Berio, not Brahms and Beethoven. But Diaz-Jerez finds them much richer and more satisfying than, say, the experiments of modernists in the 1950s and 60s using the technique of “total serialism”, which results in almost random choices of pitch, rhythm and other musical parameters. Some listeners might feel that, until Iamus can show itself capable of producing more familiar kinds of melody to compare with those of Mozart, its real potential as a musical maestro remains to be decided.

Others, such as the music critic Tom Service, have suggested that Iamus’s creators are making a mistake by programming it to generate music like that of human composers, using the same repertoire of traditional orchestral sounds, rather than seeing whether it can produce music that is more genuinely novel.

But Vico insists that these are early days. The possibility of generating new forms of music, perhaps by blending the rules of existing genres, is one of the prospects that excites him most.

Ugadi, by Iamus, on violin

Iamus’s ultimate value, however, might not be so much as a composer in its own right but as a factory of musical ideas, which human composers can mine for inspiration.

“In the future I think there will be two kinds of composer”, says Díaz-Jerez. “There will be those who admit to using the [Iamus] repository and those who don’t.”

You might be tempted to call this cheating – taking the output of a computer and calling it your own. But Diaz-Jerez argues that this would invoke a false idea of how music has always been composed. As well as using the aforementioned rules rather than some free flow of arbitrary ideas, composers have long borrowed ideas and fragments from one another. Several of J. S. Bach’s fugues in The Well-Tempered Clavier, often regarded as the epitome of his genius, use themes taken from earlier works. The other arts are no different either, with their constant mimicking of styles and themes.

Kinoth, by Iamus, on violin and piano

So delving into Iamus’s repository would be simply a routine extension of old practices. The truth is, Diaz-Jerez says, that composition is less the act of divine inspiration it is commonly perceived to be, and more of a methodical craft. Like all crafts, it often has to be produced to a deadline, and Diaz-Jerez says that the ready-mades offered by Iamus speed up the process considerably. One doesn’t have to use them intact, and he generally makes changes to effect improvements – a superfluous voice deleted here, a note altered there. But he finds that Iamus can already create compositions with great invention and complexity.

In fact Diaz-Jerez often finds himself personifying the software. Describing some of the riches at a recent meeting in Malaga, called Zero music: Music after the advent of the computer-composer, he was constantly (and tellingly) correcting himself: “What he – I mean, it – has done here is…”

And the fact that Iamus fools many listeners into believing its music is human means Iamus passes the musical equivalent of the “Turing test”, devised by computer-theory pioneer Alan Turing as a criterion for assessing whether a machine shows artificial intelligence: if you can’t tell the difference between the responses of a computer and those of a human, there’s no logical reason to deny it ‘intelligence’.

If you would like to comment on this, or anything else you have seen on Future, head over to our Facebook or Google+ page, or message us on Twitter.