81 lines · 1.5 KB · Text
RawDownload
// more chirping... // patch with envelope and panSinOsc s => Envelope e => Pan2 p => dac;// gain.5 => s.gain; // pan hard left-1 => p.pan;// call chirpchirp( 127, 20, 1::second ); // wait for envelope to go down10::ms => now;// pan hard right1 => p.pan;// call chirpchirp( 20, 120, 1::second, 100::ms ); // wait a second1::second => now; // randomize panMath.random2f( -1, 1 ) => p.pan;// call chirpchirp( 30, 110, .5::second ); // wait for envelope to go down10::ms => now;// panMath.random2f( -1, 1 ) => p.pan;// call chirpchirp( 110, 30, 1::second, 100::ms ); // wait a second1::second => now;  // chirp functionfun void chirp( float src, float target, dur duration ){    // just call the other one with default tinc    chirp( src, target, duration, 1::ms );}  // chirp function (with tinc)fun void chirp( float src, float target, dur duration, dur tinc ){    // initialize freq    src => float freq;    // find the number of steps    duration / tinc => float steps;    // find the inc    ( target - src ) / steps => float inc;    // counter    float count;    // set env    .01 * duration / second => e.time;    // open env    1 => e.keyOn;     // do the actual work over time    while( count < steps )    {        // increment the freq        freq + inc => freq;        // count        1 +=> count;         // set the freq        Std.mtof( freq ) => s.freq;         // advance time        tinc => now;    }     // close env    1 => e.keyOff;} 

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t