Created
September 22, 2012 20:56
-
-
Save konsumer/3767813 to your computer and use it in GitHub Desktop.
Plays creepy random sitar music when Tony types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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