<br><br><div><span class="gmail_quote">On 9/24/06, <b class="gmail_sendername">Graham Coleman</b> &lt;<a href="mailto:gc@gehennom.net">gc@gehennom.net</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm not sure if there's anything in chuck that will currently do this,<br>but I think you could write something like a noise gate, that tracks the<br>amplitude of samples coming from a SndBuf and skips ahead until the level
<br>rises above a threshold.<br><br>Not sure how well this would run in real time.<br><br>Better, would be something that preprocesses the file with in/out points<br>so the skips are quick.</blockquote><div><br><br>But.... It doesn't look like it needs to be realtime.
<br><br>I'd think about playing the file once and storing the sample locations where the volume drops below a treshold (as well as the ones where it comes back) in a array, then playing it a second time and skipping those sections while writing the results to a new file. in &quot;silent&quot; mode this should be doable faster then realtime.
<br><br>You could also make a array of the length of the file (in samples) and only write buf.last() =&gt; array[sample++] as long as it's over the treshold. Once the buffer reaches it's end you'd playback the array again and record that, taking care to stop after the highest value that &quot;sample&quot; got to in the first pass. This would be CPU intesive but it's quite clean as a method, I think.
<br><br>It all stands or falls with the quality of the envelope follower.<br><br>I've been thinking about doing something similar to the first option and pre-scanning wavefiles for positive zero-crossings and storing those in a array. This would take extra time when loading a file but from then on you could do very clean loops, for example to loop just a few cycles. I wonder how samplers that have a &quot;snap to zero crossings&quot; setting do this. It might still be quite tricky because not all samplers that do this do it all that well....
<br><br>Hope that's of some use.<br>Kas.<br></div></div>