[PD] Detect silence inArray and resize

Matteo Sisti Sette matteosistisette at gmail.com
Sun Apr 4 10:56:54 CEST 2010


 > anyone have any idea how to do this?

The first approach that comes to my mind and that I would try is:

- use [env~] (or anything similar) to measure the amplitude of the signal

- start a [timer] when you start recording

- set TWO thresholds: one high threshold to detect when the "note" has 
begun (attack) and a low threshold to detect that it has finished.

- Only after the signal amplitude has become greater than the HIGH 
threshold _and_ when it becomes again lower than the LOW threshold, then 
you fire the right inlet of the [timer] to measure the time passed since 
the beginning: you multiply by the sampling rate and you obtain the size.


That is, you have to emulate the behaviour of a [threshold~] object and 
use its "rest" bang (see threshold help patch).
Since you're probably gonna use [env~] you cannot actually use 
[threshold~] but it's very easy to emulate its behaviour (at least 
simplified as described here which is enough for this purpose).

- Be sure your patch produces the size only once within the recording 
time (which is predetermined if i understood correctly). If you want to 
allow two or more fff staccato notes to be recorded in one "sample", 
then take the _last_ occurrence of the abovedescribed condition (one 
transition up the high threshold + one transition below the lower 
threshold); if you want to allow only one fff staccato note to be played 
(and suppose so), then take the _first_ occurrence.



This is certainly a very simple and probably a bit naif approach, but I 
would give it at least a try before diving into something more complicated.

Hope it helped

bye
m.

-- 
Matteo Sisti Sette
matteosistisette at gmail.com
http://www.matteosistisette.com




More information about the Pd-list mailing list