<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) =&gt; string path;</div><div>```<br></div><div><br></div><div>At this point, the string &quot;path&quot; is &quot;C:\Program Files (x86)\ChucK\audio\123.wav&quot;.<br></div><div><br></div><div>```<br></div><div>&quot;/audio/123.wav&quot; =&gt; string filename;<br>// + sign connects strings together!<br>path+filename =&gt; filename;</div><div>```<br></div><div><br></div><div>so when you concatenate it with the &quot;filename&quot; string, you end up with a string with the contents &quot;C:\Program Files (x86)\ChucK\audio\123.wav/audio/123.wav&quot;, 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(&quot;C:\Program Files (x86)\ChucK\audio\&quot;) =&gt; string path;<br>// sound file we want to play<br>&quot;123.wav&quot; =&gt; string filename;<br>// + sign connects strings together!<br>path+filename =&gt; filename;</div><div>```</div><div><br></div><div>I haven&#39;t been able to test this, since I&#39;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 &lt;<a href="mailto:maria.indigo7325987@gmail.com">maria.indigo7325987@gmail.com</a>&gt; 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 =&gt; dac;<br>// get file path<br>me.dir(C:\Program Files (x86)\ChucK\audio\123.wav) =&gt; string path;<br>// sound file we want to play<br>&quot;/audio/123.wav&quot; =&gt; string filename;<br>// + sign connects strings together!<br>path+filename =&gt; filename;<br>// tell SndBuf to read this file<br>filename =&gt; mySound.read;<br>// set gain<br>0.5 =&gt; mySound.gain;<br>// play sound from the beginning<br>0.1 =&gt; mySound.pos;<br>// advance time so we can hear it<br>second =&gt; 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>