[chuck-users] How can I filter silence?

Kassen signal.automatique at gmail.com
Sun Sep 24 16:23:58 EDT 2006

On 9/24/06, Graham Coleman <gc at gehennom.net> wrote:
> I'm not sure if there's anything in chuck that will currently do this,
> but I think you could write something like a noise gate, that tracks the
> amplitude of samples coming from a SndBuf and skips ahead until the level
> rises above a threshold.
> Not sure how well this would run in real time.
> Better, would be something that preprocesses the file with in/out points
> so the skips are quick.

But.... It doesn't look like it needs to be realtime.

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 "silent" mode this should be doable
faster then realtime.

You could also make a array of the length of the file (in samples) and only
write buf.last() => 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 "sample" got to in the
first pass. This would be CPU intesive but it's quite clean as a method, I

It all stands or falls with the quality of the envelope follower.

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 "snap to zero crossings" setting do this. It might
still be quite tricky because not all samplers that do this do it all that

Hope that's of some use.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20060924/f913afc3/attachment.htm 

More information about the chuck-users mailing list