Hi, The relevant code is here:
``` me.dir(C:\Program Files (x86)\ChucK\audio\123.wav) => string path; ``` At this point, the string "path" is "C:\Program Files (x86)\ChucK\audio\123.wav". ``` "/audio/123.wav" => string filename; // + sign connects strings together! path+filename => filename; ``` so when you concatenate it with the "filename" string, you end up with a string with the contents "C:\Program Files (x86)\ChucK\audio\123.wav/audio/123.wav", which is not the correct path. The correct code might look like this: ``` // get file path me.dir("C:\Program Files (x86)\ChucK\audio\") => string path; // sound file we want to play "123.wav" => string filename; // + sign connects strings together! path+filename => filename; ``` I haven't been able to test this, since I'm not at a Windows computer right now, but if my understanding is correct, it should work. Hope that helps! Best, Hugh On Mon, 16 Dec 2019 at 13:41, maria p cruz <maria.indigo7325...@gmail.com> wrote: > Hi Everyone! > Wath is wrong in this code? > > > // Using SndBuf to play a sound file > // by ChucK Programmer, December 2050 > SndBuf mySound => dac; > // get file path > me.dir(C:\Program Files (x86)\ChucK\audio\123.wav) => string path; > // sound file we want to play > "/audio/123.wav" => string filename; > // + sign connects strings together! > path+filename => filename; > // tell SndBuf to read this file > filename => mySound.read; > // set gain > 0.5 => mySound.gain; > // play sound from the beginning > 0.1 => mySound.pos; > // advance time so we can hear it > second => now; > // > _______________________________________________ > chuck-users mailing list > chuck-users@lists.cs.princeton.edu > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users >
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users