Dynamic Music

Posted by (twitter: @geekygenius_)
August 5th, 2012 12:03 am

I was thinking a little the other day, and it occurred to me that there was a very easy way to play endless music in a game, that was simple enough  to be able to be included in a Ludum Dare. This may not be revolutionary, but its still a pretty good idea in my opinion.

Most music is organized into sections. Intro, chorus, verses, bridges, and the outro. If you had separate tracks for each section, you could play them in a continuous manner. Begin the game with the exciting Intro, then transition into your chorus, followed by a verse, another chorus, then more verses, etc. There is no need for an outro here, because there isn’t enough time to play one once the player exits the game, unless you wanted to transition between songs, in which case you would need one. As long as your individual songs didn’t do anything like change key or tempo, without a way to bring it back to the original, it would sound fine.

One note to anyone thinking about implementing this, when you render your song, make sure that you include the remainder. This will keep any leftover sound, mostly from your effects like reverb or delay. When you play your sections back, you need to know the exact length of their content with no remainder, so you can start the next one on cue and the remainder from the previous section will seamlessly bleed over into the next section. Using a tempo like 60 or 120 bpm will make it so it ends on a solid second value, which can be handy if you don’t want to keep track of milliseconds.

Have fun with your dynamic song structure, and good luck in LD24!


2 Responses to “Dynamic Music”

  1. stigrv says:

    That sounds a lot like DirectMusic (http://en.wikipedia.org/wiki/DirectMusic) to me. Great minds think alike :)

  2. sorceress says:

    That’s an interesting idea.

    If you use the .it format (or some other tracker formats), there is a jump instruction that can be used to create continuous tracks. Write your intro patterns, then your chorus and verse patterns, then a jump instruction pointing to the beginning of the chorus.

    Of course, using that technique, you can’t transition between songs, or to an outro…It’s a shame that tracker formats don’t have conditional jumps, that can be activated/deactivated by an external process during playback.

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]