Created
December 1, 2013 00:15
-
-
Save anonymous/7726738 to your computer and use it in GitHub Desktop.
test
This file contains 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
[43,43,41-12,46, 42,45-12,47+12,47] @=> int note_array[]; | |
repeat(6){ | |
for(0 => int i; i<note_array.cap(); i++){ | |
note_array[i] => int mnote; | |
generate_osc("saw", mnote, 0.0, 0.14, [2, 130, 12, 120]); | |
120::ms => now; | |
} | |
} | |
4::second => now; | |
fun void s_generate_osc( | |
string osc_type, | |
int note, | |
float pan, | |
float vgain, | |
int adsr[]) | |
{ | |
SawOsc vocOsc; | |
// if (osc_type=="saw") { | |
// <<< "here" >>>; | |
// SawOsc vocOsc;} | |
// else if (osc_type=="sin") { | |
// SinOsc vocOsc;} | |
// else if (osc_type=="tri") { | |
// TriOsc vocOsc;} | |
// else if (osc_type=="sqr") { | |
// SqrOsc vocOsc;} | |
// else if (osc_type=="pls") { | |
// PulseOsc vocOsc;} | |
ADSR voiceEnv; | |
vocOsc => voiceEnv; | |
adsr[0] => int a; | |
adsr[1] => int d; | |
adsr[2] => int s; | |
adsr[3] => int r; | |
voiceEnv.set( a::ms, d::ms, 0.12, r::ms ); | |
voiceEnv => Pan2 panObj => dac; | |
vgain => vocOsc.gain; | |
pan => panObj.pan; | |
note => Std.mtof => vocOsc.freq; | |
voiceEnv.keyOn(); | |
(a+d)::ms => now; | |
voiceEnv.keyOff(); | |
r*2::ms => now; // wait for tail to finish. | |
vocOsc =< panObj; // disconnect to clean up | |
panObj =< dac; | |
} | |
fun void generate_osc( | |
string osc_type, | |
int note, | |
float pan, | |
float vgain, | |
int adsr[]) | |
{ | |
spork ~ s_generate_osc(osc_type, note, pan, vgain, adsr); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment