Sign in to follow this  
Bixilo

Dynamic music generation?

Recommended Posts

I was wondering if anyone knows of projects that use "dynamic" music generation. That is, the music in a game would always be unique and be spontaneously generated by an algorithm that looks at the state of the game (enemies on screen, health points, whatever) and produces music to the mood or tone of that state. I looked on Google and couldn't seem to find anything, so now I'm asking you =)

Share this post


Link to post
Share on other sites
I really dont think that Idea is all together feasable. Wanting music genertated for a mood, seems like writing music for a mood. You'd need a huge function to tell a computer how to write music. I think more what you're looking for is a way to tell the computer which pre-recorded music to play based on the mood, computer generated sound isnt going to sound like music without alot of work to make it so.

Now, this is the point where I might just be spouting nonsense because Im no audio programmer, but if a different track for each mood combination seems unreasonable, you could have different mood affecting stats affect different parts of the music. Say, at a certain health % the music starts to speed up, getting slightly faster as the health drops.

Share this post


Link to post
Share on other sites
I know there's a few games out there that switch music selection depending on some basic environment stuff -- it's usually more of the rudimentary "play A.mp3, unless you're being attacked, in which case fade to B.mp3" variety AFAIK however.

A more involved system would involve keeping the various mixer tracks of a piece seperated instead of mixing everything into a single final mp3, and playing with mixer or filter settings at runtime.

Share this post


Link to post
Share on other sites
I did a little bit of looking into this a couple months ago, just out of interest and I was curious to know if it could be done. I came across a few university papers on the topic, and it seems that there really isn't anything out there yet that can purely generate music that would consistently sound like music, so much as noise.

While I am not fully sure of how feasible it is, as i have never done this myself, it seems like a better approach would be to work with an artist and generate a large library of beats and patterns which could be strung together to give the appearance of constantly unique audio.

I am sure there are many ways you could tackle this, I wonder if maybe the Music Genome project might hold a few clues as well.

Good luck.

Share this post


Link to post
Share on other sites
I know there is a DigiPen game, Oasis Ostinato, that has done this. The game was a variation on a tower defense game. The music was randomly generated throughout playing the game. It would change the style of music based on how well you were doing, how many enemies were on the screen, and so on. It was pretty cool to see how well it fit the game.

Here is the link. Just as a note, the link does not function as of yet because the game has yet to be posted to the DigiPen gallery.
http://www.digipen.edu/main/Gallery_Games_2007#Oasis_Ostinato

Share this post


Link to post
Share on other sites
You can change some aspects of existing music (tempo, pitch, volume, fading, etc) which will be able to provide quite a bit of different flavors of the same thing. For example, if you just ate a Super Magic Shroom of Health and Hallucations, you can decrease the tempo and pitch, do some fading, place down some reverb and you might have yourself a decent yet basic "acid trip" variation. Or decrease the pitch, add a bit more bass and such and you can have an "in a different room" variation. If this is the route you want to go, I recommend checking out Audacity and the plugins for it. With a lot of time you can probably find the alterations you want.

As far as actually writing music, I can't really see that happening without a lot of work and being very basic. You will probably also have to generate the music from the notes rather than altering compiled music, which just throws in another huge challenge of getting decent quality.

Share this post


Link to post
Share on other sites
Hellgate London did do something dynamic. If memory serves, it works at the level of taking pieces of music and splicing them together intelligently based on context.

You can find some research in the academic field about dynamic music with varied results. I did some stuff at the individual note level with neural networks and transition tables with iffy results, and there's an article floating around about jazz music with genetic algorithms. There's also some stuff utilizing grammars. Wikipedia has an OK article on this stuff, but I don't remember the keywords that get to it.

Share this post


Link to post
Share on other sites
Thanks for the replies everyone.

So far it appears that it would be difficult to "generate" music. I have known games that play different prerecorded bits and pieces of music depending on what you're doing, for example the Hitman series, or the games you mentioned. In terms of generating music, I think it would be easier (and provide a more pleasant gaming experience) to have more "ambient" music. Then it wouldn't have to be too structured, and be more of a backdrop, which is what I think game music should be. Recently I discovered Wolfram tones - http://tones.wolfram.com/
Not as high quality as hand-written music, of course, but it's the closest thing I've seen so far to purely generated music.

Share this post


Link to post
Share on other sites
Halo 3 does something sort of like this, they talk about it a little on the special features DVD (YouTube). The music was still all scored by a composer and recorded, but different tracks are cued in and some details are adjusted depending on what is happening in the game.

Even way back in Mario Brothers we got faster music when time was running out, so the idea isn't exactly new, there doesn't seem to be a whole lot of information readily available on implementation of the most advanced techniques out there though.

Share this post


Link to post
Share on other sites
My dad happens to be an interactive computer musician, so I'm well aware that this is possible (and that it's been done), although I don't know of any game examples.
http://en.wikipedia.org/wiki/Algorithmic_composition
There are even pieces of software geared towards algorithmic composition:
http://nosuch.com/keykit/
http://www.pgmusic.com/

I'll ask him where some more deep material can be found. TBH I think you're asking the wrong crowd (myself included). Algorithmic composition is presumably practical for real-time, so what you need are documents describing how to do it, right?

Share this post


Link to post
Share on other sites
I wanted to get a broad idea of it, but unfortunately I don't have time to implement anything right now. But knowing the "official name" - algorithmic composition - actually helps a lot in locating resources, thanks

Share this post


Link to post
Share on other sites
Another early example is the iMuse engine that has fist been used in Monkey Island 2. Remember e.g. when you were in the swamp walking towards the entrance of the voodoo lady's hideout? The closer the player got, the more instrument tracks were added to the music.

Then again, dynamic composition is a feature of DirectMusic. I wonder whether this has been used very often in games...

Both examples are, of course, MIDI based, which most likely just isn't enough for modern games anyway.

Regards,
Andre

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this