<div dir="ltr"><div>Hi,</div><div><br></div><div>The relevant code is here:</div><div><br></div><div>```<br></div><div>me.dir(C:\Program Files (x86)\ChucK\audio\123.wav) => string path;</div><div>```<br></div><div><br></div><div>At this point, the string "path" is "C:\Program Files (x86)\ChucK\audio\123.wav".<br></div><div><br></div><div>```<br></div><div>"/audio/123.wav" => string filename;<br>// + sign connects strings together!<br>path+filename => filename;</div><div>```<br></div><div><br></div><div>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.</div><div><br></div><div>The correct code might look like this:</div><div><br></div><div>```<br></div><div>// get file path<br>me.dir("C:\Program Files (x86)\ChucK\audio\") => string path;<br>// sound file we want to play<br>"123.wav" => string filename;<br>// + sign connects strings together!<br>path+filename => filename;</div><div>```</div><div><br></div><div>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.<br></div><div><br></div><div>Hope that helps!</div><div><br></div><div>Best,<br><br></div><div>Hugh<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 16 Dec 2019 at 13:41, maria p cruz <<a href="mailto:maria.indigo7325987@gmail.com">maria.indigo7325987@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Everyone!</div><div>Wath is wrong in this code?</div><div><br></div><div><br></div>// Using SndBuf to play a sound file<br>// by ChucK Programmer, December 2050<br>SndBuf mySound => dac;<br>// get file path<br>me.dir(C:\Program Files (x86)\ChucK\audio\123.wav) => string path;<br>// sound file we want to play<br>"/audio/123.wav" => string filename;<br>// + sign connects strings together!<br>path+filename => filename;<br>// tell SndBuf to read this file<br>filename => mySound.read;<br>// set gain<br>0.5 => mySound.gain;<br>// play sound from the beginning<br>0.1 => mySound.pos;<br>// advance time so we can hear it<br>second => now;<br>//<br></div>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote></div>