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 <[email protected]> > Subject: [chuck-users] reading random sample > Date: January 28, 2015 at 6:32:29 AM GMT-5 > To: ChucK Users Mailing List <[email protected]> > Reply-To: ChucK Users Mailing List <[email protected]> > > > 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 <[email protected]> > Subject: Re: [chuck-users] reading random sample > Date: January 29, 2015 at 6:25:08 AM GMT-5 > To: [email protected] > Reply-To: ChucK Users Mailing List <[email protected]> > > > 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 >
_______________________________________________ chuck-users mailing list [email protected] https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
