Monday, January 12, 2015

Music Generation in Rogue Matrix

I should be able to wrap Rogue Matrix up tomorrow, just working some kinks out of the music engine. I want to get this in good working order because the music is the only thing I really like about Rogue Matrix. It's about the simplest procedural music generation system I could think of, & ignoring some technical constraints imposed by Game Maker which I'm still working through, it's been pretty simple to implement.

It works like this. I wrote five songs, each one minute long & loopable, all in the same key & at the same BPM. Each song has 4 parts: drum, bass, harmony, melody. Once the song is written, I save each part as its own track. So I have 5 drum tracks, 5 bass tracks, etc. Then, at the beginning of a level of Rogue Matrix, the system chooses at random one of the available drum parts, bass parts, etc. & plays them all at the same time on a loop. So the drum part of song C is played with the bass part of song A, the melody of song B & the harmony of song D. Or whatever. The five minutes of music that I wrote become over 10 hours worth of possible combinations:

5 songs, 4 parts each
So when generating a song there are 5 choices for each of the 4 parts
That's 5^4 = 625 possible unique songs
The parts, & therefore the songs, are all one minute long
625 minutes = 10.4167 hours
10.4167 hours > The amount of time anyone will ever spend playing this game

I think of this as a song template; because the key & tempo are always going to be the same, songs from the same template will be pretty similar to each other. This was just an experiment; Rogue Matrix uses a single song template, but adding more is just a matter of writing the base jams. Writing those songs, by the way, is a lot fun & relatively easy; you can't be bothered with obsessing over anything because it's just going to be disassembled & frankensteined together with the other songs. I'm really looking forward to scaling this system up for some future project.

No comments:

Post a Comment