1
$\begingroup$

Currently, I am interested in how NNs or any other AI models can be used for composing music.

But there are many other interesting applications too, like language processing.

I am wondering that: NNs generally need a cost function for learning. But for example, for composing music, what would be an appropriate cost function? I mean, algorithms can't (yet) really 'calculate' how good music is, right?

$\endgroup$
  • 1
    $\begingroup$ You have a training dataset for optimising cost function...Singers are first trained...Then they compose music. $\endgroup$ – DuttaA Sep 15 '18 at 16:17
1
$\begingroup$

You've hit upon the central conundrum of supervised learning: if you want a machine to learn to do something, you need to know how to explain what that something is.

In the case of music, there are several possible approaches:

  • Make one set of "bad" songs, and one set of "good" songs. Develop a measure of how similar two songs are (maybe euclidian distance between their discrete Fourier transforms is a good starting place?). Your cost function is then based minimizing the average distance to "good" songs, and maximizing the average distance to "bad" songs. This may not work well though, because good and bad songs might differ only in the occasional misplaced notes.

  • Move to a reinforcement learning paradigm. Listen to each song proposed by your network. Give is a score based on your subjective enjoyment. Your cost function is based on maximizing this score. This might work well, but again, it might not. Music is tricky.

  • Use unsupervised approaches. Reward your network just for making something that resembles music (perhaps using the Fourier transform approach above), without labelling good and bad. The advantage is that you don't need to decide what is good or bad, and so you can use a lot more music in your dataset. The drawback is music as a whole might be too diverse to learn easily from examples.

  • Treat your music as a sequence of notes, and train a generative model to predict future notes on the basis of past notes. You can then generate new music by starting the model with a set of notes and letting it generate new ones for a long time.

$\endgroup$
  • $\begingroup$ @NeilSlater Indeed! I should have thought of that. I've updated the answer. $\endgroup$ – John Doucette Sep 16 '18 at 12:57
  • $\begingroup$ About your last point: If I understand you correctly, an option would be to plug a rnn output into its input again, so that the predicted note of the previous timestep is the new input. But how would I train it then? Would I just let it follow existing music, and the error is the difference between the predicted next note and the actual next note in that piece of music? $\endgroup$ – Ben Sep 16 '18 at 20:17
  • $\begingroup$ @Ben That's the essential idea. There are specific kinds of neural networks that are intended to train on sequences in this way. The link in my last point is to an easy-to-use package for training LSTMs, which might be helpful if you want to go that route. $\endgroup$ – John Doucette Sep 17 '18 at 1:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.