Re: Audio limiter

Chris Robinson <[email protected]> Fri, 30 Nov 2012 01:59:10 -0800
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
On 11/30/2012 12:35 AM, Mariusz 'MX' Szaflik wrote:
> Hi
>
> I'm porting some XAudio2 stuff (from PC/XBox) to the OpenAL (MAC, but I
> may use OAL-SOFT as well) and I'm in need to use limiter
> to dynamicaly adjust volumes of played sounds based on feedback
> information from mixer itself.
> In XAudio there is a XAPO filter 'volume meter' with returns Average and
> Peak _UNCLIPPED_ volumes per channel from each mixer quantum, from that
> feedback information
> I could easily create limiter that eliminates audio clipping almost
> completly.
>
> How to acomplish this properly in OpenAL ? I do not see any extension
> that could give me the feedback info of UNCLIPPED volumes.

There isn't, currently. It might be a good idea to make an extension 
that provides the average and peak amplitudes for each channel, though.

Or I could add a compressor. EFX actually contains a compressor effect 
(OpenAL Soft doesn't implement it yet), but it probably wouldn't be 
useful without being able to apply it to the full mix so it handles the 
combination of the direct path and any and all effects.

EFX really needs a way to connect multiple effects together into a 
chain. I hope I'll be able to do something like that for OpenAL Soft 
somewhat soon.

> For now I'v implemented dirty hack in OpenAL-Soft that calculates MAX of
> all samples produced by mixer before clipping (in each step (2048
> samples or so)) and developer my extension from this ... but I want to
> avoid custom OAL builds if it is possible at all (for maintance reasons
> mainly).

An alternative may be to use the ALC_SOFT_loopback extension to get the 
rendered samples, which you can then calculate the peaks and modify as 
you need before writing out somehow (though this will limit output a 
bit; HRTF won't work, and you'll be restricted with the speaker configs 
compared to letting OpenAL handle it internally).
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal