Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to "muffle" the sounds that are being played in my game and the best way I can think of doing this, is by lowering the treble of the sound.

I have looked through all the members of the Song / SoundEffect / SoundEffectInstance classes and I cannot find a way to alter the sounds.

How can I accomplish this?

share|improve this question
I don't 100% know the answer but have you looked into using XACT? – Justin Skiles Oct 14 '12 at 20:47
I have not but it appears that it might be the route to go. – Kyle Uithoven Oct 15 '12 at 18:18
up vote 3 down vote accepted

With XNA you have two approaches: mix your own filters as Bjorn describes in his answer with DynamicSoundEffectInstance (it's fun, try it :) ). The other option is XACT Variables.

Watch this video to see somebody use XACT variables to dynamically change an engine sound over time using pitch. To accomplish what you want, do something similar, but use it to adjust the parameters of a low pass filter (XACT should have it built in).

You can adjust the variables via Cue.SetVariable and Cue.GetVariable. See the MSDN docs for more info. Unfortunately, Microsoft has retired XACT, so all the detailed documentation on the tool has disappeared. But there are still blog posts and videos like the one I linked that can show you how to get stuff done.

share|improve this answer
I will take a look into both the DynamicSoundEffectInstance and the XACT Variables. I have heard a lot about XACT, is it generally better or more useful to use XACT instead of the Song/SoundEffect classes? – Kyle Uithoven Oct 15 '12 at 18:19
@KyleUithoven Yes, it's generally more useful. While it has its quirks, XACT is going to give you the most flexibility and control over sound playback in your XNA game. It provides an FMOD/Wwise-like interface that makes it easy to keep your audio playback data-driven. – michael.bartnett Oct 15 '12 at 18:26
This XACT tool has worked great. I was able to achieve everything I asked for and more. Thanks! – Kyle Uithoven Oct 17 '12 at 19:58

I don't know XNA, but I can give you a generic answer:

What you want is a "low-pass filter" which is a kind of EQ, or equalizer, sometimes simply called an "audio filter". If the system you are using does not have one, you can use a moving average filter: so each sample output will be the average of the previous N inputs (the bigger N is the more "muffling" you will get, but past three or four, you'll be doing a lot of work for not much return).

If the moving average filter isn't sufficient (and it probably isn't), the standard approach is the "digital biquad". I describe how to write your own in this blog entry:

(I describe a bell filter, but a low-pass is simpler.)

share|improve this answer

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.