Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/docler_delay_array2.ck
Created November 9, 2013 20:10
Show Gist options
  • Save zeffii/7389417 to your computer and use it in GitHub Desktop.
Save zeffii/7389417 to your computer and use it in GitHub Desktop.
// utility function
fun int random_from(int arr[]){
return arr[Math.random2(0, arr.cap()-1)];
}
// setting up sounds
Gain master => dac;
0.8 => master.gain;
JCRev rvb => ADSR mf => master;
.22 => rvb.gain;
.02 => rvb.mix;
Rhodey vocs[4];
for(0 => int i; i<vocs.cap(); i++){
0.41 => vocs[i].gain;
vocs[i] => rvb; // send each voice to the same reverb unit
}
// construct tap delay of n units, this chains them
17 => int num_delays;
DelayL tap_delay[num_delays];
Pan2 delay_pan[num_delays];
Gain delay_levels[num_delays];
// this sets their parameters, turn into oneliner
fun float panning(int i){
if (i%2==0) return -.6;
return .6;
}
1.0 => float mix_val;
0.87 => float damp;
550 => int delay_period;
for(0 => int i; i<num_delays; i++){
panning(i) => delay_pan[i].pan;
(i+1)*(3*delay_period)::ms => tap_delay[i].max;
(i+1)*delay_period::ms => tap_delay[i].delay;
damp *=> mix_val => delay_levels[i].gain;
mf => delay_levels[i] => tap_delay[i] => delay_pan[i] => dac;
}
for(0 => int i; i<9; i++){
[62,65,67,69] @=> int notes[];
random_from([-3,0,5,-7]) => int transpose;
for(0 => int i; i<vocs.cap(); i++){
Std.mtof(notes[i] + transpose - 6) => vocs[i].freq;
0.41 => vocs[i].gain;
vocs[i].lfoSpeed(1); // static at 160 is good
vocs[i].lfoDepth(0.6); // static at 0.9 is fine.
Math.random2f(0.6, 0.8 ) => vocs[i].noteOn;
}
1312::ms => dur a; // attack time
349::ms => dur d; // decay time 113 is fine
0.413 => float s; // sustain level
100::ms => dur r; // release time
mf.set(a,d,s,r);
mf.keyOn(); // start attack
5::second => now;
mf.keyOff(); // start attack
1::second => now;
}
12::second => now;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment