Skip to content

Instantly share code, notes, and snippets.

@bobpoekert
Created June 25, 2011 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobpoekert/1046624 to your computer and use it in GitHub Desktop.
Save bobpoekert/1046624 to your computer and use it in GitHub Desktop.
My first Chuck instrument
MidiIn min;
MidiMsg msg;
if (!min.open(0)) me.exit();
SinOsc s => Gain g => DelayL d => dac;
s => Gain g2 => dac;
d => Gain g3 => d;
15::ms => d.delay;
0.1 => g.gain;
0.1 => g2.gain;
0.98 => g3.gain;
512 => int max;
while (true) {
if (min.recv(msg)) {
<<<msg.data2+":"+Std.mtof(msg.data2)>>>;
(Std.mtof(msg.data2) $ int) + 0 => max;
}
if (max < 0) {
0 => max;
}
Std.rand2(max-512, max) => s.freq;
0.01 ::ms=> now;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment