// name: bank.ck // desc: basic envelope follower using a one-pole filter as a leaky // integrator, and checking it against a threshold to detect // loud sound events // patch (input only) adc => Gain g => OnePole p => blackhole; // square the input adc => g; // multiply 3 => g.op; // set pole position - should always be < 1.0! .99 => p.pole; // loop while( true ) { // threshold (another parameter to tweak) if( p.last() > 0.1 ) { // print message! <<< "BANG!!!", now >>>; // give it time 80::ms => now; } // polling rate 20::ms => now; }