[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] automated buffer -- How's that get in there?!?
On Feb 11, 2006, at 3:45 PM, scacinto wrote:
Hi James,
wow. This makes what I was concieving seem a bit silly. If I had known
this project would be this crazy...
Heh heh... yeah, I threw a lot of info at you. Some of it (especially the NodeWatcher stuff) is pretty advanced, and the general architecture is just "what I would do" with 3+ years SuperCollider experience.
I don't think it's necessarily more difficult to stream the files from disk, but keeping the audio in memory will be generally more efficient.
The NodeWatcher is to make sure the buffer has the right state once the synth comes to an end. You could also skip it by using the scheduler (you know how many seconds the buffer will hold, so you could schedule the state update for that many seconds later than "now"). I like the NodeWatcher technique because it eliminates one possible discrepancy--the state will always be updated within milliseconds after processing on that buffer stops.
It works like this: registering the synth with the watcher means that server notifications applying to that node get passed through to the node. Part of the process is to update all the dependents of the node object--the Updater sets itself up as such a dependent. That triggers the function and sets the buffer's state.
In summary, synth ends, sends a message to the client which ultimately triggers the updater function.
wchoose is one of the collection methods, documented in the SequenceableCollection help file.
choose
Choose an element from the collection at random.
<x-tad-smaller>[1, 2, 3, 4].choose.postln;</x-tad-smaller>
wchoose
Choose an element from the collection at random using a list of probabilities or weights.
The weights must sum to 1.0.
<x-tad-smaller>[1, 2, 3, 4].wchoose([0.1, 0.2, 0.3, 0.4]).postln;</x-tad-smaller>
tryPerform here is basically to protect against a possible source of error--if, for some reason, the .select call returned nil, .choose would fail. tryPerform would return nil in that case instead of throwing an error (which would break your installation).
hjh
: H. James Harkins
: jamshark70@xxxxxxxxxxxxxxxxx
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:
"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal." -- Whitman