// // CurveTable Envelope // class CurveEnvelope { // members and default params Phasor drive => CurveTable curvetable => Gain multiplier; 3 => multiplier.op; // this is what makes the CurveTable an envelope! 0. => multiplier.gain; // we use this to gait the output, so start at 0. UGen source, out; 0 => drive.op; // stop the driver for now dac @=> out; 1. => float gain; 1::second => dur length; [0., 0., 0., 1., 1., 0., 2., 0.] => curvetable.coefs; // triangle window // methods fun void setEnvelopeCoefs( float _coefs[] ) { _coefs => curvetable.coefs; } fun void connectSource( UGen src ) { src @=> source; } fun void connectOutput( UGen destination ) { destination @=> out; } fun void trigger() { source => multiplier => out; // connect things gain => multiplier.gain; // open gait 1 => drive.op; 0. => drive.phase; // reset driver to beginning of envelope curve 1. / (length / second) => drive.freq; // calculate speed of driver in Hz length => now; // let it happen... 0. => multiplier.gain; // close gait 0 => drive.op; source =< multiplier =< out; // disconnect things } } // // CurveEnvelope ce; // SinOsc s; // ce.connectSource( s ); // ce.connectOutput( dac ); // ce.trigger(); // TriOsc t; // ce.connectSource( t ); // ce.connectOutput( dac ); // ce.trigger(); // <<< "done" >>>;