SinOsc s => Envelope e => Pan2 p => dac;
.5 => s.gain;
-1 => p.pan;
chirp( 127, 20, 1::second );
10::ms => now;
1 => p.pan;
chirp( 20, 120, 1::second, 100::ms );
1::second => now;
Math.random2f( -1, 1 ) => p.pan;
chirp( 30, 110, .5::second );
10::ms => now;
Math.random2f( -1, 1 ) => p.pan;
chirp( 110, 30, 1::second, 100::ms );
1::second => now;
fun void chirp( float src, float target, dur duration )
{
chirp( src, target, duration, 1::ms );
}
fun void chirp( float src, float target, dur duration, dur tinc )
{
src => float freq;
duration / tinc => float steps;
( target - src ) / steps => float inc;
float count;
.01 * duration / second => e.time;
1 => e.keyOn;
while( count < steps )
{
freq + inc => freq;
1 +=> count;
Std.mtof( freq ) => s.freq;
tinc => now;
}
1 => e.keyOff;
}