Skip to content

Instantly share code, notes, and snippets.

@konsumer
Created September 22, 2012 20:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Plays creepy random sitar music when Tony types.
Hid hi;
HidMsg msg;
hi.openKeyboard( 0 );
Sitar sit => PRCRev r => dac;
fun void pluk( int code ) {
Math.random2( 0, 11 ) => float winner;
Std.mtof( 57 + Math.random2(0,3) * 12 + winner ) => sit.freq;
Math.random2f( 0.4, 0.9 ) => sit.noteOn;
if( Math.randomf() > .5 ) {
.1::second => now;
} else {
0.2::second => now;
}
}
while( true ) {
hi => now;
while( hi.recv( msg ) ) {
if( msg.isButtonDown() ) {
pluk( msg.which);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment