mathr / blog / #

Analogue-style ADSR external for Pd

Analogue-style ADSR patch

First I implemented it as a Pd patch (above), but it was too slow and inefficient, so I reimplemented it in C (my first DSP external for Pd). To compare, the Pd version uses 20% CPU (for just one instance!), the C version about 3%.

It works completely in the signal domain: the trigger signal's rising edge triggers attack phase, the falling edge triggers release phase. The decay phase is triggered when the output signal rises above a threshold. Each phase is formed of an exponential decay towards a target. Some rudimentary denormal bashing code halved the CPU usage when idle.

You can download the source code here:

svn co https://code.goto10.org/svn/maximus/2007/analogue/