[chuck-users] reading random sample

Julian Faust julian.faust at gmail.com
Thu Jan 29 12:49:52 EST 2015


If you know in advance what set of files to choose from, you could start by reading in a text file with all the file paths then make the random selection in chuck. This avoids system calls, which can mess with the timing of your real-time application since the chuck VM misses the time spent doing the system call (i.e. Std.system(“sleep 1”) causes mayhem). But if you want to be able to add files to a directory on the fly I think you have to do the system call. Just be aware of the timing issue - maybe it can be done in a thread.

-Julian

> From: Atte <atte at youmail.dk>
> Subject: [chuck-users] reading random sample
> Date: January 28, 2015 at 6:32:29 AM GMT-5
> 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>
> 
> 
> Hi
> 
> I'm trying to write a function that reads a random samples from a
> directory into a SndBuf. I'm not aware of the the necessary
> functionality being available in chuck, so I wrote a bash script that
> picks a random file from a directory and writes the name with full path
> to /tmp/random_file. When I call Std.system() I get a warning that I
> should use --caution-to-the-wind. This works well in chuck, but in fact
> I'm in miniAudicle, how do I call miniAudicle with that option? Just doing
> 
> $ miniAudicle --caution-to-the-wind
> 
> makes miniAudicle think I want to start with a blank file called
> "--caution-to-the-wind"...
> 
> -- 
> Atte
> 
> http://atte.dk   http://a773.dk
> 
> 
> 
> From: Atte <atte at youmail.dk>
> Subject: Re: [chuck-users] reading random sample
> Date: January 29, 2015 at 6:25:08 AM GMT-5
> To: chuck-users at lists.cs.princeton.edu
> Reply-To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> 
> 
> On 01/28/2015 12:32 PM, Atte wrote:
>> how do I call miniAudicle with that option?
> 
> Nevermind, I'm back to chuck, seems much more stable...
> 
> -- 
> Atte
> 
> http://atte.dk   http://a773.dk
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20150129/1fabc5c2/attachment.html>


More information about the chuck-users mailing list