[chuck-users] chuck-users Digest, Vol 172, Issue 5

Charlie taos.points at gmail.com
Tue Dec 17 12:34:20 EST 2019


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 <chuck-users-request at lists.cs.princeton.edu>
wrote:

> Send chuck-users mailing list submissions to
>         chuck-users at 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 at lists.cs.princeton.edu
>
> You can reach the person managing the list at
>         chuck-users-owner at 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 <maria.indigo7325987 at gmail.com>
> To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> 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 <hughr2005 at gmail.com>
> To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> 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 <maria.indigo7325987 at 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 at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20191217/ba496800/attachment.html>


More information about the chuck-users mailing list