34 lines · 966 B · Text
RawDownload
// SIMPLE ENVELOPE FOLLOWER, by P. Cook /*Hi all.  I keep meaning to post to this list about the under-exploitedfeature that all unit generators have, in that you can cause their inputsto multiply rather than add.  As an example, here's a simple powerenvelope follower that doesn't require sample-level chuck intervention.  Again UG is used to square the incoming A/D signal (try it on your built-inmic), then a OnePole UG is used as a "leaky integrator" to keep a runningestimate of the signal power. The main loop wakes up each 100 ms andchecks the power, and prints out a message if it's over a certain level. You might need to change the threshold, but you get the idea.*/ // patchadc => Gain g => OnePole p => blackhole;// square the inputadc => g;// multiply3 => g.op; // set pole position0.99 => p.pole; // loop onwhile( true ){    if( p.last() > 0.01 )    {        <<< "BANG!!" >>>;        80::ms => now;    }    20::ms => now;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t