Skip to content

Instantly share code, notes, and snippets.

@hughrawlinson
Last active February 11, 2016 11:43
Show Gist options
  • Save hughrawlinson/02cec3c5319e2a4ee70d to your computer and use it in GitHub Desktop.
Save hughrawlinson/02cec3c5319e2a4ee70d to your computer and use it in GitHub Desktop.
Synthesises an approximation of the sound of a hearbeat
int bpm;
// set the beats per minute here
60 => bpm;
// this signal flow approximates the timbre shown at:
// http://www.bsignetics.com/cases/ASD.ht65.gif
Noise n => HPF h => LPF l => ADSR e => dac;
int third;
int twothird;
60000/bpm/3 => third;
third*2 => twothird;
// sets the params of the filters and the envelope generator
70 => h.freq;
l.set(150,1);
e.set(1::ms,100::ms,0,0::ms);
while(true){
e.keyOff();
e.keyOn();
third::ms => now;
e.keyOff();
e.keyOn();
twothird::ms => now;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment