Jump to content
  • Advertisement
Sign in to follow this  
Nairb

Neural Nets and Algorithmic Music

This topic is 4007 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

(This may be more appropriate in the AI forum since it involves neural nets, but the nature of the problem doesn't seem very AI-ish to me). So I have a project to implement some kind of automatic music generation using a neural network. First instinct is to use a window of previous notes/durations as the input into a backprop network to try to determine the next note. Seems similar in principal to a transition table. I have a ton of ABC files off the net I can train the network with, so that's not a huge issue. I've seen one academic paper along these lines, but it's pretty old. So I was wondering if anyone had any good thoughts on this before I continue. I am somewhat limited (the class is on Neural Nets, so I have to use an NN approach). I'm certainly not married to a specific type of NN though. It will likely be implemented in C++; Matlab is a feasible alternative and has a nice NN toolbox, but string manipulation in Matlab is abysmal, and my notes will all be represented as strings. Alternatively, if anyone knows a good format aside from ABC (the goal here is simplicity), by all means suggest it. MIDI was up there as an option, but it seems a little too complex. Any thoughts would be appreciated. Cheers, --Brian [Edited by - Nairb on October 27, 2007 7:26:48 PM]

Share this post


Link to post
Share on other sites
Advertisement
A song isn't just a linear series of notes, there can be a lot of notes occurring simultaneously and this would just be picking one thing randomly...it would probably give you about 1 unique 'song' per training set (assuming you sample the same way), but doing it on a note by note basis i doubt it would sound like much.

You might be better off to break the song up into different frequency bands and train a NN separately on each band, allowing you to have a base line as well as a melody etc.

Also, might be a good idea to just use the net to create fixed length repeating signals for certain frequencies so that you can get a consistent rhythm going instead of just random noisy stuff with no coherence.

The thing about the NN is that its basically just going to give you the "average" output that would come from the given inputs, so if you have a lot of samples to train on...well...the average might be zero.

Share this post


Link to post
Share on other sites
I'd be a little worried about the training situation. It doesn't matter how big a library of existing music you have - you'll need some way of evaluating how 'good' a composition is after the net has produced it. It's no easier to algorithmically determine the quality of a melody than it is to algorithmically compose one, and we all know how unfavourable it is to train the net yourself.

Anyway, I would recommend you do use Matlab's NN library to help out. You'll probably find that things will be a whole lot easier to manage if you store and process the music numerically. This will allow for easy interfacing with the network while allowing you to avoid the strings problem entirely. Serialising the data to and from human-readable format is a different problem altogether, and is one that C++ will be very happy to help you out with.

Admiral

Share this post


Link to post
Share on other sites
Crazy idea:

What if your inputs are time-based rather than previous note based. All music is based upon time signatures with particular notes being played at particular times. My thought is the input would be a particular time probably in seconds and fractions of a second measured from the beginning of the piece. Outputs could be a particular note frequency to be played - keeping it simple here for now. You would also obviously have a large hidden layer.

Starting with a very simple tune like Happy Birthday or Twinkle Twinkle Little Star, you should be fairly well able to capture which notes are played and when.

A more complex piece would have more outputs and thus more notes played simultaneously.

This could effectively capture and reproduce a single song, but then you could extend your training set. What if your training set consisted of multiple songs of a similar style. My guess is you would get an underlying fusion of the two. What about combining different musical styles?

-Kirk

Share this post


Link to post
Share on other sites
yahastu: Let's assume for complexity's sake that I'm only dealing with single track melodies. Simplistic, I know, but more feasible in my timeframe than trying to learn arbitrary songs.

TheAdmiral:
My idea was not to classify the entire composition after production (since, as you say, that's a significant problem in itself). I'm leaning more toward the infinite music approach, such that I don't have to worry so much about the larger structural information and can worry more about the local information (within reason). At that scale, I think training becomes a more reasonable problem (you can classify how 'good' the next note produced is based on how often a given sequence appears in the training set, which is very similar to how transition tables operate).

In retrospect, it probably is a better idea to encode my data and use Matlab's toolbox. Serializing the data is a pain (although it might not be so bad if I used MIDI, which already represents its data as numbers). A simple backprop algorithm isn't especially hard to implement, but there are a lot of other things I can play around with quickly with the toolbox.

kirkd:
I'm not so sure about this approach. It sounds like you'd be training around a lot of noise; at a given point in time, songs even of the same genre can be radically different. But maybe I'm missing something here?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!