Forums > MaxMSP

How to find silence in a buffer~?

August 21, 2011 | 8:47 pm

I have been trying for some time now to analyse a buffer~ to find areas of silence. I can do this crudely in real time by playing it back and recording when a gain~ output reaches 0 and recording timings in a coll but would like to be able to do this in non-real time without playing back the audio. Is this possible?

I have tried using peek~ and mxj buf.Op but can’t get it to work. Anyone got a pointer on where to try next?

Thanks

Dan


August 21, 2011 | 9:34 pm

This is a little beyond me, but is [zerox~] any use here??

Brendan


August 21, 2011 | 10:28 pm

I just had a go but am a bit tired :p … I’m not sure if this will always work even if the buffer starts and/or ends with silence … it probably does but you should test it :)

If it does work properly I can explain how it works if you need me to. Also, you could replace the [== 0.] part with whatever you need to. For example, to find any sample higher than a given dBFS value, put {[abs 0.] into [> 0.]} and then set the "threshold" of [> 0. ] with [float] into [dbtoa ] …

I think there are externals around to do this though. Alex Harker’s [descriptors~ ] would probably work.


August 22, 2011 | 2:25 am

Record two channels of audio: the first is the audio, the second is the decibel level. (via average~ or something similar) You’ll need to delay the first channel to account for the "warm-up" time that averaging takes. Delay~ will work for this. (you could even just record the thresholding function)

I would highly recommend the use of thresh~ or a similar two-stage threshold detector to debounce your threshold signal. (imagine your threshold value is -70 dB. What happens if your signal is fluttering between -69 and -71 dB? Yick.)


August 23, 2011 | 12:30 pm

haha … yeah my patch doesn’t work properly :p Pretty much just delete everything after [f ] and deal with the perpetual 0 first output in a different way depending on whether or not it signifies the start of a silent section.


August 23, 2011 | 1:18 pm

change? change~?


Viewing 6 posts - 1 through 6 (of 6 total)