// Simple positive-going zero crossing counter // implemented native (per sample) in ChucK adc => Gain inp => blackhole; 0.0 => float lastIn; 0 => int zeroXings; while (1) { for (0 => int i; i < 44100; i++) { // every second at 44.1 SRATE if ((lastIn < 0.0) && (inp.last() >= 0.0)) { 1 +=> zeroXings; } inp.last() => lastIn; samp => now; } <<< "Zero Crossings this 1/10th second =", zeroXings >>>; 0 => zeroXings; }