/usr/share/doc/chuck/examples/deep/plu3.ck is in chuck 1.2.0.8.dfsg-1.4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | // tuned plucked string filter
// Ge Wang (gewang@cs.princeton.edu)
// feedforward
Noise imp => OneZero lowpass => PoleZero allpass => dac;
// feedback
allpass => Delay delay => lowpass;
// our radius
.99999 => float R;
// finding our (integer) delay order
Std.mtof( 80.75 ) => setFreq => float L;
// set delay
L::samp => delay.delay;
// set dissipation factor
Math.pow( R, L ) => delay.gain;
// place zero
-1 => lowpass.zero;
// fire excitation
1 => imp.gain;
// for one delay round trip
L::samp => now;
// done
0 => imp.gain;
// advance time
(Math.log(.0001) / Math.log(R))::samp => now;
// set (fundamental) freq
fun int setFreq( float freq )
{
// sample rate
second / samp => float SR;
// omega
2 * pi * freq / SR => float omega;
// figure total delay needed
SR / freq - .5 => float D;
// the integer part
D $ int => int Di;
// the fraction
D - Di => float Df;
// set allpass using fractional and fundamental
polePos( Df, omega ) => allpass.allpass;
// return integer portion
return Di;
}
// find pole location from delay and omega
fun float polePos( float D, float omega )
{
// here it is (a la Jaffe & Smith)
return Math.sin( (1-D) * omega / 2 ) /
Math.sin( (1+D) * omega / 2 );
}
|