Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a very basic understanding of audio and was hoping I could get some help to resolve a problem with the audio design in my engine. Let me give you a run-down of how I've currently got it fitting together.

I have an AudioManager that handles setting up and tear down of the XAudio2 interface as well as the master voice, and various submix voices that I can use to group sounds. I have a ResourceManager that can be used to load audio files into the required buffers ready for XAudio2 consumption. During my game, I call a method on my AudioManager to play a sound - this obtains the necessary Audio Voice and links it to the right buffer and begins playback.

The first problem I am having is that when there is a lot going on, and a lot of sounds are played at once, I get performance issues - framerates drop, and there is audio stuttering. I currently don't limit the number of concurrent sounds that can be played - can you give me any other advice on a better design, or solutions to limit impact on performance?

The second problem I am having is that if multiples of the same sound are played at the same time, it sounds like the volume has been turned up on that particular sound. I assumed this is to do with wave amplification and tried implementing a Volume Limiter effect on my submix voices. This works to a degree, and I can eliminate any distortion, but the increased volume effect is still noticeable. Can anyone suggest decent values to use for the volume limiter effects, or any other solutions to the problem?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

How many sounds do you have playing? In my experience games will use somewhere between 32->256 audio channels. To solve your problem you need to work out your audio budget (the amount of processing / memory you will be giving to the audio system) and then prioritise sounds being played.

The methods to prioritise can include :

a) Volume - the lowest being the least important.

b) Priority - a value you set yourself based on the importance of the sound and the likely hood that the user will notice the sound dropping out. Background music, for example, should be set to never be dropped. A random cricket sound for ambience should be high on the list.

c) Grouping - If you have gunshot sounds for example, once they have hit a hard limit (say 15) you would stop adding new gunshot sounds as they wouldn't add to the overall mix.

For your second problem there are two things you can do. One, you need to balance your game audio. This is a fine and somewhat black art that people can spend a lot of time doing in games. The first step is to make sure all your sounds are normalised (http://en.wikipedia.org/wiki/Audio_normalization). The next is to play through the game adjusting volumes on the fly to get the mix right. Building in some simple debug audio functionality (a remote application that can connect and adjust the mix of the application is ideal) can make this a lot easier.

Why are you playing multiple sounds of the same type? If it necessary you can attempt to a audio compressor (link in comment). Now I don't know if XAudio has one built in, but if not they are fairly simple to implement. This gives you an increase in dynamic range - i.e if there are a lot of sounds and it is getting very loud the compressor will bring the entire mix down in an attempt to fit it in.

share|improve this answer
Thanks Olly! The MasterLimiter effect I use is basically a compressor with a high ratio and fast attack speed. I think that I'm not setting the Release parameter correctly - I've left it on the default 1000 [assume ms] but my sounds are short 1 or 2 second sfx. (msdn.microsoft.com/en-us/library/…) –  DrDeth Aug 6 '10 at 9:19
For the individual sounds, a release rate of 1000ms would be too much. However for a Limiter/Compressor the length of the individual assets don't matter - it's affecting the entire mix. On most mastering limiters (that is one at the end of your audio chain) you want a high ratio and fast attack so it comes in quick, but a very slow release so the listener doesn't notice the transition in range. Usually I set mine to even longer than 1000ms - closer to 2500ms. But its probably something you should play with and use your own judgement on. –  Olly Aug 6 '10 at 9:28
Thanks again, Olly. –  DrDeth Aug 6 '10 at 19:43
add comment

It sounds like you know the main answer to the first issue - you need to limit the number of voices. The AudioManager will need some sort of prioritization scheme that drops low priority sounds in favor of the high priority ones.

And that ties into the second question. Are you playing the two instances of the same sound at exactly the same time? Why? - they won't be distinguishable except for the increased volume Or are they slightly offset - like maybe 2 near-simultaneous gunshots - in which case, what's wrong with 2 events sounding louder than one event? That's realistic. It seems to me that you either actually do want the increased volume, or you want the AudioManager to filter out the duplicates to avoid overloading the voice hardware with needless work.

share|improve this answer
Thanks AShelly. There's nothing wrong with them sounding louder (they are a few ms offset), and it actually sounds great when there's only a few, but it just sounds like a noise when there's a lot at once. I think limiting voices and implementing a priority is the way to go. –  DrDeth Aug 6 '10 at 9:25
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.