//create the dsp patch SinOsc m => Envelope e => SinOsc c => ADSR adsr => dac; //declare variables 220 => float cf; //carrier frequency 1.1 => float harmonicity; //harmonicity factor cf * harmonicity => float mf; //modulator frequency 10 => float mi; //modulation index 5 => float gdl; //global duration amount second => dur gdt; //global duration type gdl::gdt => dur duration; //set global duration now + duration => time later; //setup a time point called "later" while( now < later ) { cf => c.freq; mf => m.freq; mf * mi => m.gain; 2 => c.sync; //************** //time point one //************** //modulator envelope stuff getp( gdl, gdt, 0.3 ) => e.duration; 1.0 => e.target; //adsr stuff adsr.set(getp( gdl, gdt, 0.15 ), getp( gdl, gdt, 0.23 ), 1.0, getp( gdl, gdt, 0.25 )); adsr.keyOn(); //advance time by quarter of total duration getp( gdl, gdt, 0.25 ) => now; //************** //time point two //************** //modulator envelope stuff getp( gdl, gdt, 0.2 ) => e.duration; 0.7 => e.target; //advance time by quarter of total duration getp( gdl, gdt, 0.25 ) => now; //**************** //time point three //**************** //modulator envelope stuff getp( gdl, gdt, 0.2 ) => e.duration; 0.4 => e.target; //advance time by quarter of total duration getp( gdl, gdt, 0.25 ) => now; //*************** //time point four //*************** //modulator envelope stuff getp( gdl, gdt, 0.1 ) => e.duration; 0.3 => e.target; //adsr stuff adsr.keyOff(); //advance time by quarter of total duration getp( gdl, gdt, 0.25 ) => now; } //function to get a proportion of total duration amount fun dur getp( float total_dur, dur dur_type, float percent_of_total ) { total_dur * percent_of_total => float proportion; return proportion::dur_type; }