Wednesday, October 17, 2012

Artificial Composers

The other day, I was listening to Tchaikovski's "Valse des Fleurs," which I find to be a particularly excellent song. I wondered, "How did Tchaikovski create this?" How did he know which notes to write down? Music is a bunch of sequences of notes which overlap in different ways. Tchaikovsky had to choose every note in every sequences and when to overlap each one. I wonder if it possible to create a machine capable of doing the same thing?

There are many possibilities of how to arrange notes. Do I start the song with an A#? How long should it last? Which note should come next? Should it begin after the A# is finished, or should it overlap? If it does overlap, by how much? How many notes should be heard at any one time?

Q-learning is a type of learning algorithm where the machine is told whether the action that it just took is 'good' or 'bad.' Usually, the machine is just given a number as feedback which is some function. For example, maybe -5 is bad, -10 is very bad, and 4 is pretty good. Over time, as the machine is rewarded and punished, it learns which actions are the wisest to take based on where it has just been and what it has done before. The machine may learn that after it turns left, it should turn right next, for example.

Might is be possible to use Q-learning to build a machine that writes music? Not just a string of sounds -- beautiful music? Let us call such a machine Beathoven.



How would Beathoven begin a new composition? It might choose a note randomly. After some random time, Beathoven chooses another note. When Beathoven chooses a note, it chooses the pitch and duration at once. We could think of Beathoven as a stream of noise. Whenever the noise spikes above a certain value, a note is produced. At any time, a listener can rate the music on some scale. Beathoven can then modify its policies based on the user feedback. Over time, Beathoven should learn how to create music pleasing to the audience.

The problem is similar to the old idea of infinite monkeys on infinite typewriters. Given enough time, they will necessarily reproduce the works of Shakespeare. Of course, "enough time" is far too long to wait. However, if the monkeys had feedback as they were writing -- we add infinite editor monkeys (1 per writer monkey) to read their work and give a thumbs up or a disappointed look. Without editors, the monkeys will explore every possible combination of letters, but editors can point out that many combinations of letters do not mean anything.

Similarly, we can tell Beathoven that certain notes make us cringe, while others may sound eerie or cheerful. We can explain, through feedback, that we like certain rhythms or melodies.

Update: It looks like somebody may be trying to implement this very idea. Apparently the notion is called "Computational Creativity".


No comments:

Post a Comment