[chuck-users] Error in book "Programming for Musicians and digital artists by Ge Wang" ?

herman verbaeten hverb54 at hotmail.com
Wed Feb 12 16:15:51 EST 2020


Hi,

I was looking in your book and copied listing 4.3 " Playing a sound file backward"
But it didn't work. Hopefully i did everything correctly. It did perform the first (forward) part but during the reverse part i heard nothing. Can you please help me....

Kind regards,

Herman


 // copy Listing 4.3 Playing a sound file backward
// from Programming for Musicians and digital artists by Ge Wang

me.sourceDir() + "sample.wav" => string filename;
if( me.args() ) me.arg(0) => filename;

// the patch
SndBuf mySound => dac;

// load the file in buf
filename => mySound.read;

mySound.samples() => int numSamples;

0 => mySound.pos;                  // this was ok
numSamples::samp => now;

numSamples => mySound.pos;     // This was not heard. Athough the program stayed in VM.
-1.0 => mySound.rate;
numSamples::samp => now;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200212/622aecd2/attachment.html>


More information about the chuck-users mailing list