<br><br>On Sunday, 11 August 2013, HP-mini  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
for (unsigned i = 0; i &lt; frameSamples; i++)<br>
     avgabs = (avgabs / (i+1)) * i + abs(samples[i]) / (i+1);<br>
<br></blockquote><div><br></div><div>This method will only work if using floats... With int you&#39;ll accumulate errors as you go.</div><div>You&#39;re better off using the previous method (add them all and only divide outside the loop.</div>
<div>All types must be changed so you don&#39;t compare signed vs unsigned</div><br><div>Note that it is my plan to add in 0.28 silence commercial detection<span></span></div>