Last week I was reading my friend Shawn’s blog post “Random shuffle” and it reminded me of a system I worked on that controlled the playback of sound effects.
When you play sound effects in a game you will often want to have a number of sound effects that can be played for each event in the game. For example you may have multiple sounds for when a player takes damage. Having multiple sound effects for events especially those that occur often in the game prevents the user from becoming annoyed and keeps the audio less predictable.
If you build games using XNA for Windows or Xbox 360 you may be familiar with the Microsoft Cross-Platform Audio Creation Tool or XAct for short. XAct allows you to setup audio cues that consist of multiple wave files. In your game code you tell XAct to play a specific cue. The cue then determines which of the specific wave files to play.
The specific wave to play is determined by the “Variation Playlist” setting for the audio cue.
XAct provides six different variation types:
· Ordered – The waves in the cue are played in a specific configured order.
· Ordered from Random – The waves are put into a random order and are then played in that order.
· Random – A random wave is selected and played.
· Random (no immediate repeats) – A random wave is played but is guaranteed not to be a repeat of the previous wave. Of course if there is only a single wave in the cue the sound will have to repeat.
· Shuffle – The list of wave that can be played are shuffled and then played in the shuffled order. Once all waves have been played the list is shuffled again.
· Interactive – Allows for interactive control between the game and XAct more info can be found here.
Often shuffle or random (no immediate repeats) will be what you want to use for your game.
If you are building a game on Windows Phone 7 you unfortunately won’t have access to the functionality provided by XAct and you will need to build the variation functionality into your game yourself.
In my next post I will discuss a simple sound effect instance variation system that you can use in your WP7 games.