|
Preventing audio clipping with ALLEGRO_AUDIO_DEPTH_INT* |
dthompson
Member #5,749
April 2005
|
I was finding that my game's audio was occasionally clipping when 3 or 4 samples were playing simultaneously, even when everything was at a relatively quiet volume. I'd put this down to good ol' fashioned superposition, and was unsure what to do until I came across this thread, which suggested using ALLEGRO_AUDIO_DEPTH_FLOAT32. This solved the problem - I'm guessing because for everything up to 0dB, the full range of the integer is used, whereas floats can exceed the usual ±1 representation. I resolved that anything > 0dB when using ALLEGRO_AUDIO_DEPTH_INT* just overflows, meaning nyquist pops because the waveform changes polarity. Anyway, let's say I demanded to use ALLEGRO_AUDIO_DEPTH_INT* for whatever reason. I can't find any mitigations for the clipping in this case. Would it be feasible to write a soft limiter, presumably with al_set_mixer_postprocess_callback? ______________________________________________________ |
|