Jump to content

  • Log In with Google      Sign In   
  • Create Account


XAudio2: FXMasteringLimiter produces clipping ?!


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Iveco   Members   -  Reputation: 102

Like
0Likes
Like

Posted 08 April 2011 - 10:38 AM

Hello,

I am using XAudio2 2.6 and I noticed many of my sounds are having slight glitches at the end. When I disabled my FXMasteringLimiter all clipping and glitches/clicks/pops at the end of the sounds were gone. But I need to have a compressor/limiter to prevent the peaks when too many sounds are playing.

Quote from someone: "The mastering limiter applies a dynamic volume-adjusting algorithm that helps ensure that mixing lots of sounds never clips, and therefore avoids the distortion. On one project of mine, it completely cured some horrible distortion when a lot was going on."

So how come the internal XAudio2 XAPO is so weak that it actutally does produce glitches when being used? I am doing something wrong?

Regards,

Iveco

Sponsor:

#2 turnpast   Members   -  Reputation: 928

Like
1Likes
Like

Posted 10 April 2011 - 12:58 PM

How are you submitting sounds? I mean do you directly start and stop your source voices with a new buffer for each sound?
If you are stopping the voice you might want to use the XAUDIO2_PLAY_TAILS flag to make sure the playing buffer is not truncated which could potentially produce pops/clicks.

Do the sounds you are submitting always start and end with silence?
If you are starting and stopping continuous/looping sounds you may want to make sure that the playing sound is always silence at the points where it stops and starts. For example you could ramp the volume to 0 just before stopping the sound and ramp from 0 when starting (though this is much easier to guarantee on sound starts).

#3 Iveco   Members   -  Reputation: 102

Like
0Likes
Like

Posted 11 April 2011 - 08:40 AM

Thank you very much for you reply. Getting help with native XAudio2 implementations is rare, and knowledge is golden (or kept like secrets) in this area.

>> I mean do you directly start and stop your source voices with a new buffer for each sound? <<

Correct. I've attached the FXMasterLimiter to the MasterVoice with initialstate set to true and I am playing all SourceVoices directly with a newly created buffer for each sound, while the SourceVoices are pre-created on game start and only a fixed amount of them exists with preconfigured wave format settings.

>> If you are stopping the voice you might want to use the XAUDIO2_PLAY_TAILS flag to make sure the playing buffer is not truncated which could potentially produce pops/clicks. <<

I've tried this, but it did not have any effect. I think it's used for Reverb effects and co. and would make sense to use there, but it didn't help with my particular problem.
I've even tried delaying the Stop() for a few frames or using OperationIDs to delay the stopping proccess, but this didn't help.
I also played around with the FXMasterLimitere EffectParamers (Loudness and Release) but no combination helped.

>> Do the sounds you are submitting always start and end with silence? <<

Here you got me on the right track. The soundeffect I was playing didn't have a silence on the end. After adding a minor silence at the end, I've got rid of the glitch after stopping the SourceVoice. I am stopping the SourceVoices as soon as the BuffersQueued is zero and the pCurrentBufferContext is NULL.

----------------

Thank you very much for your piece of information which helped me finding this problem.

I will keep sure the mastered non-loopable sound assets will have a short silence on start and beginning. Do you know which length at the end would make sense best? Is there any standard for this?

Regards from Germany,

Iveco

#4 turnpast   Members   -  Reputation: 928

Like
1Likes
Like

Posted 11 April 2011 - 02:05 PM

Glad you were able to track this down. I know how hard it is to find helpful information on XAudio2.

I will keep sure the mastered non-loopable sound assets will have a short silence on start and beginning. Do you know which length at the end would make sense best? Is there any standard for this?


I don't know if there is any meaningful standard, but you probably want to insure that if your sound gets truncated mid buffer there is no distortion. My tests indicate that Xaudio2 uses buffers of ~ 1/100 a second and at a sample rate of 44100/sec that is 441 frames. So if I were you I would pad with at least 1/100th of a second of silence.

#5 Iveco   Members   -  Reputation: 102

Like
0Likes
Like

Posted 12 April 2011 - 09:12 AM

Thanks ^_^




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS