<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Preventing audio clipping with ALLEGRO_AUDIO_DEPTH_INT*</title>
		<link>http://www.allegro.cc/forums/view/617707</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 22 Jan 2019 23:52:58 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I was finding that my game&#39;s audio was occasionally clipping when 3 or 4 samples were playing simultaneously, even when everything was at a relatively quiet volume. I&#39;d put this down to good ol&#39; fashioned superposition, and was unsure what to do until I came across <a href="https://www.allegro.cc/forums/thread/614208">this thread</a>, which suggested using <span class="source-code">ALLEGRO_AUDIO_DEPTH_FLOAT32</span>.</p><p>This solved the problem - I&#39;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 &gt; 0dB when using <span class="source-code">ALLEGRO_AUDIO_DEPTH_INT<span class="k3">*</span></span> just overflows, meaning nyquist pops because the waveform changes polarity.</p><p>Anyway, let&#39;s say I demanded to use <span class="source-code">ALLEGRO_AUDIO_DEPTH_INT<span class="k3">*</span></span> for whatever reason. I can&#39;t find any mitigations for the clipping in this case. Would it be feasible to write a soft limiter, presumably with <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_mixer_postprocess_callback"><span class="a">al_set_mixer_postprocess_callback</span></a></span>?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (dthompson)</author>
		<pubDate>Tue, 22 Jan 2019 23:52:58 +0000</pubDate>
	</item>
</rss>
