[chuck-users] Machine.add() (.yield) from mike clemow

Perry Cook prc at cs.princeton.edu
Thu Jul 2 18:48:26 EDT 2020


Depending on how HUGE the SndBuf files are, I have often loaded all of the files
sequentially at the beginning, before I make any sound at all, into a single SndBuf, 
not to play them, but to get them into the cache. Then when the time comes to 
truly load them, they can be zero-disk loads.  If they’re too big, this won’t work 
of course because you’ll exhaust your cache.

PRC

> On Jul 2, 2020, at 2:19 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. Machine.add() and me.yield() (mike clemow)
>   2. Re: Machine.add() and me.yield() (Michael Heuer)
>   3. Re: Machine.add() and me.yield() (mike clemow)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Thu, 2 Jul 2020 16:43:51 -0400
> From: mike clemow <michaelclemow at gmail.com>
> To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> Subject: [chuck-users] Machine.add() and me.yield()
> Message-ID:
> 	<CADddD5mL1NzWPVs4GgX=VPsezSUPw-01O_=iAKMDfuPxYtDBiQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Greetings Chuckists,
> 
> Looking for validation on this before I change many, many lines of code:
> I'm noticing clicks and pops in running audio when I do something like this:
> 
> Machine.add("thingOne.ck");
> Machine.add("thingTwo.ck");
> Machine.add("thingThree.ck");
> Machine.add("thingFour.ck");
> 
> and also with Machine.remove(idNum); four times in a row.
> 
> Question:
> 
> Is this:
> 
> Machine.add("thingOne.ck");
> Machine.add("thingTwo.ck");
> Machine.add("thingThree.ck");
> Machine.add("thingFour.ck");
> me.yield();
> 
> significantly different than this:
> 
> Machine.add("thingOne.ck");
> me.yield();
> Machine.add("thingTwo.ck");
> me.yield();
> Machine.add("thingThree.ck");
> me.yield();
> Machine.add("thingFour.ck");
> me.yield();
> 
> ???
> 
> The same for sporking shreds four in a row.
> 
> Warmly,
> Mike
> 
> --
> Michael Clemow
> Artist/Composer/Sound Designer
> http://michaelclemow.com
> (he/him)
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200702/af44d845/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 2
> Date: Thu, 2 Jul 2020 16:07:41 -0500
> From: Michael Heuer <heuermh at gmail.com>
> To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> Subject: Re: [chuck-users] Machine.add() and me.yield()
> Message-ID: <48B17D40-CEC3-4D9F-8550-B8290DB4E0F1 at gmail.com>
> Content-Type: text/plain; charset="us-ascii"
> 
> Hello Mike,
> 
> Since Machine.add is hitting the file system and parsing and evaluating the ChucK scripts, it might work better to do all of that in one go when not generating sound
> 
> Machine.add("thingOne.ck");
> Machine.add("thingTwo.ck");
> Machine.add("thingThree.ck");
> Machine.add("thingFour.ck");
> 
> And then later call methods to initialize them serially or in different shreds, something like
> 
> thingOne.start();
> thingTwo.start();
> thingThree.start();
> thingFour.start();
> 
> spork ~ thingOne.start();
> spork ~ thingTwo.start();
> spork ~ thingThree.start();
> spork ~ thingFour.start();
> 
> Hope this helps,
> 
>   michael
> 
> 
>> Begin forwarded message:
>> 
>> From: mike clemow <michaelclemow at gmail.com>
>> Subject: [chuck-users] Machine.add() and me.yield()
>> Date: July 2, 2020 at 3:43:51 PM CDT
>> To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
>> Reply-To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
>> 
>> Greetings Chuckists,
>> 
>> Looking for validation on this before I change many, many lines of code: I'm noticing clicks and pops in running audio when I do something like this:
>> 
>> Machine.add("thingOne.ck");
>> Machine.add("thingTwo.ck");
>> Machine.add("thingThree.ck");
>> Machine.add("thingFour.ck");
>> 
>> and also with Machine.remove(idNum); four times in a row.
>> 
>> Question:
>> 
>> Is this:
>> 
>> Machine.add("thingOne.ck");
>> Machine.add("thingTwo.ck");
>> Machine.add("thingThree.ck");
>> Machine.add("thingFour.ck");
>> me.yield();
>> 
>> significantly different than this:
>> 
>> Machine.add("thingOne.ck");
>> me.yield();
>> Machine.add("thingTwo.ck");
>> me.yield();
>> Machine.add("thingThree.ck");
>> me.yield();
>> Machine.add("thingFour.ck");
>> me.yield();
>> 
>> ???
>> 
>> The same for sporking shreds four in a row.
>> 
>> Warmly,
>> Mike
>> 
>> --
>> Michael Clemow
>> Artist/Composer/Sound Designer
>> http://michaelclemow.com <http://michaelclemow.com/>(he/him)
>> _______________________________________________
>> 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/20200702/e0bf2f2d/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 3
> Date: Thu, 2 Jul 2020 17:19:25 -0400
> From: mike clemow <michaelclemow at gmail.com>
> To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> Subject: Re: [chuck-users] Machine.add() and me.yield()
> Message-ID:
> 	<CADddD5mGKqob9oRU=kOocgpyrUH3p2QaxnqJivdtHXFn5YJoFg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Hey Michael! It's been a minute!
> 
> Thanks so much for that suggestion! I took a closer look at this code and
> I'm actually not doing Machine.add(); four times in a row, but rather spork
> ~ thingOne(); four times (although I do Machine.remove() four times to
> remove the shreds by ID).
> 
> I still think the thing that I forgot to do is to add me.yield(); in
> between each of these (or at least at the end of the four lines) to keep
> the running audio smooth. I'm going through and trying it out.
> 
> Since each of these functions that are running concurrently are loading
> large files into SndBuf instances, I'm hesitant to do the normal Chuckian
> thing and load it all up first and then let it play on demand using, as you
> suggest, a start() function or similar. Also, because I'm triggering these
> "cues" from across a network, I'm trying to trade "immediate and real time"
> for "reliable and low-memory impact." I've definitely built applications
> like that with Chuck that ate all the memory before! There's no streaming
> from disk implemented under the hood, unless I'm mistaken.
> 
> Let me see how this works and I'll report back!
> 
> Mike
> 
> 
> --
> Michael Clemow
> Artist/Composer/Sound Designer
> http://michaelclemow.com
> (he/him)
> 
> 
> On Thu, Jul 2, 2020 at 5:07 PM Michael Heuer <heuermh at gmail.com> wrote:
> 
>> Hello Mike,
>> 
>> Since Machine.add is hitting the file system and parsing and evaluating
>> the ChucK scripts, it might work better to do all of that in one go when
>> not generating sound
>> 
>> Machine.add("thingOne.ck");
>> Machine.add("thingTwo.ck");
>> Machine.add("thingThree.ck");
>> Machine.add("thingFour.ck");
>> 
>> And then later call methods to initialize them serially or in different
>> shreds, something like
>> 
>> thingOne.start();
>> thingTwo.start();
>> thingThree.start();
>> thingFour.start();
>> 
>> spork ~ thingOne.start();
>> spork ~ thingTwo.start();
>> spork ~ thingThree.start();
>> spork ~ thingFour.start();
>> 
>> Hope this helps,
>> 
>>   michael
>> 
>> 
>> Begin forwarded message:
>> 
>> *From: *mike clemow <michaelclemow at gmail.com>
>> *Subject: **[chuck-users] Machine.add() and me.yield()*
>> *Date: *July 2, 2020 at 3:43:51 PM CDT
>> *To: *ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
>> *Reply-To: *ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
>> 
>> Greetings Chuckists,
>> 
>> Looking for validation on this before I change many, many lines of code:
>> I'm noticing clicks and pops in running audio when I do something like this:
>> 
>> Machine.add("thingOne.ck");
>> Machine.add("thingTwo.ck");
>> Machine.add("thingThree.ck");
>> Machine.add("thingFour.ck");
>> 
>> and also with Machine.remove(idNum); four times in a row.
>> 
>> Question:
>> 
>> Is this:
>> 
>> Machine.add("thingOne.ck");
>> Machine.add("thingTwo.ck");
>> Machine.add("thingThree.ck");
>> Machine.add("thingFour.ck");
>> me.yield();
>> 
>> significantly different than this:
>> 
>> Machine.add("thingOne.ck");
>> me.yield();
>> Machine.add("thingTwo.ck");
>> me.yield();
>> Machine.add("thingThree.ck");
>> me.yield();
>> Machine.add("thingFour.ck");
>> me.yield();
>> 
>> ???
>> 
>> The same for sporking shreds four in a row.
>> 
>> Warmly,
>> Mike
>> 
>> --
>> Michael Clemow
>> Artist/Composer/Sound Designer
>> http://michaelclemow.com
>> (he/him)
>> _______________________________________________
>> 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/20200702/dbf21af4/attachment.html>
> 
> ------------------------------
> 
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> 
> 
> End of chuck-users Digest, Vol 179, Issue 1
> *******************************************



More information about the chuck-users mailing list