[openal] How to use AL_EFFECT_COMPRESSOR
chris.kcat at gmail.com
Thu Apr 3 12:01:56 EDT 2014
On 04/03/2014 07:43 AM, Mariusz 'MX' Szaflik wrote:
> stupid (?) question - how to use AL_EFFECT_COMPRESSOR ? (openALSoft,
> latest version)
> | |->[COMPRESSOR]->OUT
> DF1 is AL_FILTER_LOWPASS
> DF2 is AL_FILTER_LOWPASS
> RVB is AL_EFFECT_EAXREVERB
> how the COMPRESSOR fits into this ?
> it should be where I wrote it above, but there is no chaining of global
> effects - I'm right ?
Unfortunately the way EFX effects work doesn't allow for using a
compressor on the final output mix. It will only act on a given effect
send, and further, OpenAL Soft will mix those effect sends to a mono
stream (all sends mix to a mono buffer in the effect slot, without
panning, then the effect itself will spread it to all output channels as
> How OpenALSoft is dealing with clipping ?
> I ask because there is much less clipping heard compared to XAudio2
> version of sound engine.
> (let's say i have 10 cannons on the ship firing at once - OpenAl version
> sounds much better without compressor than the XAudio one - is there
> some 'anti clipping' code in mixer ?)
I don't know how XAudio works internally, but OpenAL Soft adds a bit of
attenuation to mono sounds that get played centered, according to how
many output channels there are. This means that centered mono sounds are
slightly quieter, so they won't overflow as quickly/badly and the
subsequent clamping won't be as noticeable.
This attenuation is added so mono sounds will (roughly) keep the same
perceived volume as when it's panned to one speaker. Otherwise, if a
centered mono sound played 100% on all speakers, there would be up to
700% more power (for 7.1 output) compared to when it's panned to play on
one speaker only. And IMO that's not very desirable for sounds that
freely move around in 3D space.
More information about the openal