On Sun, Apr 04, 2010 at 10:56:54AM +0200, Matteo Sisti Sette wrote:
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).
You could use the [m_thresholds] abstractions in the rj-library here.
Frank