[chuck-users] background music
Tom Lieber
tom at alltom.com
Mon Dec 7 23:31:40 EST 2009
could you guys make this a little better for me? one file max tho. thx
100::ms => dur d;
Step s => dac;
0.1 => s.gain;
Moog w => dac;
0.1 => w.gain;
1 => w.noteOn;
Moog w2 => Envelope env => dac;
.2 => w2.gain;
1 => w2.noteOn;
d => env.duration;
1 => env.keyOn;
fun float warble() {
return Std.rand2f(2.5/1.01, 2.5*1.01);
}
fun void sweep(float freq, dur d) {
w.freq() => float start;
for(0 => int i; i < 10; i++) {
(i / 10.) * (freq - start) + start => w.freq;
w.freq() * warble() => w2.freq;
d / 10. => now;
}
freq => w.freq;
freq * warble() => w2.freq;
walk(env.target(), .0, 1, .3) => env.target;
1 => env.keyOn;
}
fun void yay() {
d * 4 => dur e;
while(true) {
Std.rand2(1, 2)::e => now;
spork ~ sweep(Std.rand2(60, 70) => Std.mtof, Std.rand2f(1/60.,
1/10.)::e);
}
}
spork ~ yay();
while(true) {
Std.rand2(1, 2)::d => now;
0.1 => s.next;
Std.rand2(1, 2)::d => now;
-0.1 => s.next;
d => now;
1 => s.next;
d => now;
-1 => s.next;
}
fun float walk(float current, float min, float max, float step) {
Std.rand2f(current - step, current + step) => float n;
if(n < min) min => n;
if(n > max) max => n;
return n;
}
--
Tom Lieber
http://AllTom.com/
More information about the chuck-users
mailing list