Yo all, Based on discussions of DSP in ChucK, I thought I'd split it out into a new thread. The last time I taught my music DSP intro course (COS325 Transforming Reality Through Computer, named long ago by Paul Lansky and Ken Steiglitz when they taught it on NeXT Machines!!), I taught it in STK AND ChucK (with just a touch of MATLAB for completeness). Most all examples are provided in C, C++ (via STK), and ChucK. http://www.cs.princeton.edu/courses/archive/spr09/cos325/ Lately I've been doing a lot of intro ChucK lecturing (Cal Arts, ASU, etc.) and have been showing them how to do things in at least 3 ways: 1) Directly in the Language 2) Using built-in Unit Generators (example, building a flute from delay lines) 3) Using higher-level built-in Unit Generators (example, using the Flute UG) For example, a two-pole feedback filter can be done directly in the language, with arrays, and Step for output: // ***************************************** // Two Pole Resonator directly in ChucK Noise n => Gain input => blackhole; Step output => dac; [0.0, 0.0] @=> float outputs[]; [-1.977755, 0.998001] @=> float coeffs[]; 0.001 => input.gain; while (1) { input.last() - outputs[0]*coeffs[0] - outputs[1]*coeffs[1] => float temp; outputs[0] => outputs[1]; temp => outputs[0] => output.next; 1 :: samp => now; } // ***************************************** or with Delay unit generators (by the way, this is a way to do a UG based arbitrary order FIR/IIR filter): // ***************************************** // Two Pole Resonator using Delays Noise n => Gain output => dac; output => Gain d1 => output; // 1 sample delay output => Delay d2 => output; // 2 sample delay 1 :: samp => d2.delay; // feedback adds 1 sample of delay 1.977755 => d1.gain; -0.998001 => d2.gain; 0.001 => n.gain; while (1) { 1.0 :: second => now; } // ***************************************** Or, using the built-in TwoPole Unit Generator: // ***************************************** // Two Pole Resonator Unit Generator Noise n => TwoPole tp => dac; 1000.0 => tp.freq; 0.999 => tp.radius; 0.001 => tp.gain; while (1) { 1.0 :: second => now; } // *****************************************
participants (1)
-
Perry Cook