[chuck-users] altering a sample while it reads
Tomtom
tomtom at herbesfolles.org
Thu May 19 11:46:47 EDT 2011
Hi Tim
> Is there a way to control aspects of a sample (rate, reverb, delay) while it
> is being read? I'm interested in, say, playing a minute-long speech sample
> and being able to change the effects as it is playing. I've done this with
> supercollider and pure data but can't seem to find the resources in chuck.
All you have to do is to load your sample in a SndBuf ugen (or is there another
ugen for very long samples ?) and then chuck (=>) its output to your effects -
you are free to change the effects parameters whenever you like, or even to
reroute the signal.
for example, a script randomly changing the reverb parameters every 10ms
(beware, code not tested):
SndBuf buf => JCRev rev => dac;
"mysample.wav" => buf.read;
while (true) {
Std.rand2f(0,1) => rev.mix;
10::ms => now;
}
Now, you might want to manually play with the parameters during the playback.
In that case, you will have to use Events [1]: a part of your code is listening
to an Event object, and when the event is triggered, it does something - in
your case, changing a parameter. This mechanism allows you to do some
message-passing between differents parts of your program.
In your case, you can have one script doing the playback and listening to an
Event object - then, changing the parameters is a matter of triggering events
from your "livecode".
I hope this helps
tom
More information about the chuck-users
mailing list