Hello... Use the SndBuf class to play a sample:
http://chuck.cs.princeton.edu/doc/program/ugen_full.html#sndbuf
Here's the example code from ChucK docs*:
// the patch
SndBuf buf => dac;
// load the file
"../data/snare.wav" => buf.read;
// time loop
while( true )
{
0 => buf.pos;
Std.rand2f(.2,.9) => buf.gain;
Std.rand2f(.5,1.5) => buf.rate;
100::ms => now;
}
*But note, that code is changing the gain and rate of the sample
randomly - you would want a rate of 1.0 to just play the file at
original speed/pitch.
Anyway, you can just plug SndBuf it into a filter, set the filter ...
and there you go!
Oh and use WvOut to record ChucK output to a file:
http://chuck.cs.princeton.edu/doc/program/ugen_full.html#WvOut
"This class provides output support for various audio file formats.
It also serves as a base class for "realtime" streaming
subclasses... WvOut writes samples to an audio file... WvOut currently
supports WAV, AIFF, AIFC, SND (AU), MAT-file (Matlab), and STK RAW
file formats."
Hope that helps.
~David
On 1/19/07, jochen lists
hi, sorry about this stupid question, but i can't seem to find any documentation on how to use chuck to process audio files, i.e. open a wav, aiff, whatever and run it through some filters. is this possible??? thx - jochen
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users