Hey everyone!
The holiday season is in full swing and as you might’ve guessed from my last post my hopes of solving the integration between Wwise and Unity were thin. However, I sticked with it and did not want to give up, even though I was told that it probably wouldn’t work.
To refresh your memory: I wanted to calculate the currently playing song’s Beats Per Minute (BPM). However it seemed like this part of Wwise was not a part of what was integrated in Unity. I did however spend a lot of time both with friends and teachers to try and figure this thing out. On the very last day before my holidays my teacher and I made a breakthrough!
I had been thinking all along that this information could be reached from any kind of method as long as it could reach the event that I had created in Wwise that played the song.
As you might guess from how I am writing this, that was not the case. After going over the source code, Wwise-documentation and trying different things we finally tried to work deeper within a specific callback method. What we were trying to reach was the duration of one beat. We knew that this was reachable within the AkMusicSyncCallbackInfo (this name alone should probably have hinted me enough from the start that it had to be written inside a specific callback method to start with), but we didn’t know how to reach it.
When we put it inside my previous MusicSyncBeat callback method it all started to click. In this method the AkEventCallbackMsg included all the information we needed and could be reached if we just specified what part of the information that was important. We set a new variable for the AkMusicSyncCallbackInfo and reached this information from within the AkEventCallbackMsg. From here we could easily assign the Beat Duration to a new float variable that we called BeatL. Dividing 60 with the beat duration would then give us the result we wanted. The BPM of the song in question is 90, something that both Unity and I now agreed on. Finally!
I am so very happy that this finally worked and hopefully this will help a few others who want to do the same thing.
My next move is to connect this to the player character, the enemies and maybe even the world around. Having a living world moving to the sound of the music is something that I’ve always enjoyed in video games. For example the level “Music Madness” from Donkey Kong Country Returns or “Grassland Groove” from Donkey Kong Country Tropical Freeze.
I highly recommend checking out those two levels if you’re interested in how music can be well integrated into the very soul of a video game level. There are certainly a lot more examples of this in other games.
The goal with Rhythm, Paper, Scissors is first and foremost to get the music to affect your own actions rather than the environment around you, but if there’s time I’m hoping to explore this as well.
Now, happy holidays everyone and see you all next year!
0 comments