<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><br>
<span></span></div>
<div><span>Yeah, I know there's a bit of clipping.</span></div>
<div><br>
  <span></span></div>
<div><span>I
 think it's because I'm summing what amount to a bunch of normalized 
random data -- so some of those sums end up outside -1 &lt; x &lt; +1, 
though I do normalizing steps between sums, so... I don't know exactly 
where the clipping is coming from -- I think it's coming from my "poor 
man's reverb" effect, which, that thing should probably be replaced with
 something better and faster, but... like I said, I don't know JACK 
about DSP, I'm just playing around with my computer and my compiler and 
my soundcard.</span></div>
<div><br>
</div>
<div>Best thing ever would be to send me a patch!</div>
<div><br>
  <span></span></div>
<div><span>-- steve<br>
  </span></div>
<div><br></div><div><br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Jeremy Salwen &lt;jeremysalwen@gmail.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> Stephen Cameron &lt;smcameron@yahoo.com&gt;<br><b><span style="font-weight: bold;">Cc:</span></b> "linux-audio-user@lists.linuxaudio.org" &lt;linux-audio-user@lists.linuxaudio.org&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Friday, October 28, 2011 9:09 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [LAU] Explodomatica - explosion sound effect generator<br></font><br>
<meta http-equiv="x-dns-prefetch-control" content="off"><div id="yiv1192631043">Very cool.&nbsp; I was playing around with it.&nbsp; I do have one suggestion though: It seems you are introducing unwanted artifacts due to clipping.<br><br>First, you probably don't want clipping.&nbsp; However, it is showing up, even in your demo samples.<br>

<br>Second, you might want clipping (Probably we've ingrained digital clipping in our perception of explosion sounds), but if you do, you're not clipping in the right way.&nbsp; I haven't looked at your code, but because I had the exact same symptoms while using libsndfile, I'm guessing that what you are doing is feeding libsndfile floats with values &gt;1 or &lt;-1.&nbsp; If you want proper clipping, these samples would be pulled to the closest value within the range [-1,1].&nbsp; However, due to performance reasons (I'm guessing), this is not what libsndfile does, but instead it wraps around.&nbsp; So 1.1 will be interpreted as the amplitude of -0.9.&nbsp; <br>

<br>Here's what it looks like:&nbsp; http://i.imgur.com/sselM.png&nbsp; <br><br>That image is from demo0.wav.&nbsp; This causes the "clicking" artifacts you hear in the file.&nbsp; In order to fix this, just go through and find any samples &gt; 1 and replace them with 1, and similarly with -1, right before you write the data out with libsndfile.&nbsp; This should give you proper "chopped peaks" clipping.&nbsp; Or, if you don't want clipping at all, just calculate the max amplitude and divide every sample by it before outputting.<br>

<br>Good luck and thanks,<br>Jeremy<br><br><br><br><div class="yiv1192631043gmail_quote">On Fri, Oct 28, 2011 at 2:05 PM, Stephen Cameron <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:smcameron@yahoo.com" target="_blank" href="mailto:smcameron@yahoo.com">smcameron@yahoo.com</a>&gt;</span> wrote:<br>

<blockquote class="yiv1192631043gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: times new roman,new york,times,serif; font-size: 12pt;">

<div><br></div><div>I made a little explosion sound effect generator, the idea being to help out people looking for such things for making video games, and so on.&nbsp; It&nbsp; relies on portaudio, libsndfile, and gtk2.</div><div>

<br></div><div>I don't really know what I'm doing when it comes to DSP, so probably some of you will laugh when you see my algorithms.&nbsp; But it does more or less make explosion sounds.</div><div><br></div><div>It's here:<br>

</div><div>http://smcameron.github.com/explodomatica</div><div><br></div><div>Enjoy<br></div><div><br></div><div>-- steve</div><div></div></div></div>

<br>_______________________________________________<br>
Linux-audio-user mailing list<br>
<a rel="nofollow" ymailto="mailto:Linux-audio-user@lists.linuxaudio.org" target="_blank" href="mailto:Linux-audio-user@lists.linuxaudio.org">Linux-audio-user@lists.linuxaudio.org</a><br>
http://lists.linuxaudio.org/listinfo/linux-audio-user<br>
<br></blockquote></div><br>
</div><meta http-equiv="x-dns-prefetch-control" content="on"><br><br></div></div></div></body></html>