Calculating Music EXCITEMENT!
ooo! ooO! oOO! OOO!
Y’all probably know that we’re working on a game that allows you to take your MP3 library and organically grow worlds from them (if not, here’s a quick vid). With the IGC and IGF coming up, we’re starting to put the finishing touches on our submisisons.
By which I mean I’m running around like I’m on fire, trying to tie together core functionality.
In order for the game to work, we’ve created procedural level generators to turn sound into architecture and enemy paths. We built those generators with dozens of inputs (to control everything from how furious the action is to how ominously red everything looks). And we’re now plugging things into them. To wit:
For starters, I want to calculate a single number that determines how “exciting” a song is. For that, we take a look a spectral analysis over a period of time (which tells us how strong the high and low notes are). For ten seconds of the totally rockin’ theme song to our game, Drunken Robot Pornography, it looks like this:
For an Enya track, it’s smoother:
And for white noise (static, a la television tuned to a dead channel), it’s ridiculous:
I’ll leave the boring math out, but the approach is this: the number of times the algorithm sees a peak towards the top over that period is a good indication of the song’s pace. To test this, we the above, and a few others for a total of five tracks (the final two suggested by a certain Alex S. via Twitter):
- The Drunken Robot Pornography theme (remix here).
- Enya’s A Day Without Rain.
- White noise/static (which if you really want to listen to, is here).
- Tank!, the theme to Cowboy BeBop.
- Rise, the theme to Ghost in the Shell 2nd Gig.
For completeness, here are the spectra over time for Tank! and Rise, respectively:
So, I ran all of these songs through SuperSculpt_Music, and got these values for “excitement” (defined as total peaks divided by song length times a constant):
- Static: 171624 (“Ludicrous”)
- Drunken Robot Pornography: 4398 (“Exciting”)
- Tank!: 2385 (“Exciting”)
- Rise: 546 (“Active”)
- A Day Without Rain: 0 (“Relaxed”)
These aren’t linear (DRP’s theme isn’t twice as “exciting” as Tank! — it just means that there are more distinct peaks), but the game now has one way of telling how active a song is. And for fun, here’s a level running Daler Mehndi’s classic and totally bizarre Tunak Tunak Tun.