Also .pos is an integer but here it’s set to a float (0.1). Cheers,
Charlie
On Tue, Dec 17, 2019 at 12:00 PM
Send chuck-users mailing list submissions to chuck-users@lists.cs.princeton.edu
To subscribe or unsubscribe via the World Wide Web, visit https://lists.cs.princeton.edu/mailman/listinfo/chuck-users or, via email, send a message with subject or body 'help' to chuck-users-request@lists.cs.princeton.edu
You can reach the person managing the list at chuck-users-owner@lists.cs.princeton.edu
When replying, please edit your Subject line so it is more specific than "Re: Contents of chuck-users digest..." Today's Topics:
1. SndBuf Error. (maria p cruz) 2. Re: SndBuf Error. (Hugh Rawlinson)
---------- Forwarded message ---------- From: maria p cruz
To: ChucK Users Mailing List Cc: Bcc: Date: Mon, 16 Dec 2019 13:41:35 -0500 Subject: [chuck-users] SndBuf Error. 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; //
---------- Forwarded message ---------- From: Hugh Rawlinson
To: ChucK Users Mailing List Cc: Bcc: Date: Mon, 16 Dec 2019 15:22:58 -0500 Subject: Re: [chuck-users] SndBuf Error. 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
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