// Compute RMS (root-mean-square) power // in native (per-sample) ChucK // by Perry R. Cook, updated Jan. 2014 adc => Gain inp => blackhole; 0.0 => float power; while (1) { for (0 => int i; i < 4410; i++) { // 1/10 second at 44100 SRATE inp.last()*inp.last() +=> power; samp => now; } <<< "Power this 1/10th second =", Math.sqrt(power/4410.0) >>>; 0.0 => power; }