// name: doh.ck // desc: detect clap/loud sound using envelope follower // no sound, using for analysis adc => Gain g => OnePole p => blackhole; // double adc to g adc => g; // multiple all inputs at g 3 => g.op; // set pole position on leaky integrator / envelope follower .99 => p.pole; // synthesis SndBuf doh => dac; // read built-in file "special:dope" => doh.read; // silence for now 0 => doh.gain; // time loop while( true ) { // check for threshold if( p.last() > 0.25 ) { // detected, take action! <<< "BANG!!!", now/second >>>; // make sound! 1 => doh.gain; 0 => doh.pos; // give time for envelope follower return below threshold 80::ms => now; } // poll time 10::ms => now; }