Very cool.  I was playing around with it.  I do have one suggestion though: It seems you are introducing unwanted artifacts due to clipping.<br><br>First, you probably don&#39;t want clipping.  However, it is showing up, even in your demo samples.<br>

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

<br>Here&#39;s what it looks like:  <a href="http://i.imgur.com/sselM.png">http://i.imgur.com/sselM.png</a>  <br><br>That image is from demo0.wav.  This causes the &quot;clicking&quot; artifacts you hear in the file.  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.  This should give you proper &quot;chopped peaks&quot; clipping.  Or, if you don&#39;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="gmail_quote">On Fri, Oct 28, 2011 at 2:05 PM, Stephen Cameron <span dir="ltr">&lt;<a href="mailto:smcameron@yahoo.com">smcameron@yahoo.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div style="color:#000;background-color:#fff;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.  It  relies on portaudio, libsndfile, and gtk2.</div><div>

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

</div><div><a href="http://smcameron.github.com/explodomatica" target="_blank">http://smcameron.github.com/explodomatica</a></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 href="mailto:Linux-audio-user@lists.linuxaudio.org">Linux-audio-user@lists.linuxaudio.org</a><br>
<a href="http://lists.linuxaudio.org/listinfo/linux-audio-user" target="_blank">http://lists.linuxaudio.org/listinfo/linux-audio-user</a><br>
<br></blockquote></div><br>