//gkc: demonstation of dyna.compress() mode //a compressor reduces the gain of events above a //volume threshold, according to a gain ratio: //ratio = input:output or input/output //this tends to make the volume of all the events more uniform //usually, you apply gain to compensate for the reduction //to make the overall signal louder sndbuf inst => dyna dyn => dac; "special:dope" => inst.read; //set the mode and presets dyn.compress(); //fiddle with the presets dyn.thresh( math.pow(10, -25/20.0) ); //-25 db dyn.attackTime( 10::ms ); dyn.releaseTime( 100::ms ); //dyn.slope( 0.5 ); dyn.ratio( 3.0 ); //some gain to compensate //dyn.gain( 2.0 ); inst.gain( 0.6 ); for(0=>int i; ;i++) { //toggle processing every 4 beats if ( i%4==0 ) { dyn.op( -dyn.op() ); <<<"op:",dyn.op()>>>; } //events of building volume inst.gain( 0.1 * math.pow(2,(i%4+1)) ); inst.pos( 0 ); 1::second => now; }