Difference between revisions of "ChucK/dinky.ck"
From CSWiki
Line 1: | Line 1: | ||
− | also see [[ChucK/try.ck|try.ck]] and the [[ChucK/Programs/Dinky|dinky] example page. | + | also see [[ChucK/try.ck|try.ck]] and the [[ChucK/Programs/Dinky|dinky]] example page. |
// this class defines the Dinky instrument | // this class defines the Dinky instrument |
Latest revision as of 20:42, 21 February 2006
also see try.ck and the dinky example page.
// this class defines the Dinky instrument // the variables defined at class level are member variables // // to test this: // > chuck dinky.ck try.ck // // NOTE: in a future version of chuck... // this class will be able to extend UGen // the Dinky class public class Dinky { // impulse to filter to dac impulse i => biquad f => Envelope e; // set the filter's pole radius .99 => f.prad; // set equal gain zeros 1 => f.eqzs; // set filter gain .2 => f.gain; // set the envelope .001::second => e.duration; public void radius( float rad ) { rad => f.prad; } public void gain( float g ) { g => i.gain; } public void connect( UGen ugen ) { e => ugen; } // t is for trigger public void t( float freq ) { // set the current sample/impulse 1.0 => i.next; // set filter resonant frequency freq => f.pfreq; // open the envelope e.keyOn(); } // t is for trigger (using MIDI note numbers) public void t( int note ) { t( std.mtof( note ) ); } // another lazy name: c (for close) public void c() { e.keyOff(); } }