[chuck-users] sample player class
signal.automatique at gmail.com
Sat Feb 7 19:07:26 EST 2009
> I've written a sampler class that simplifies various things, that I found I
> have to re-invent over and over again:
> * Polyphony, with dynamic voice allocation (stealing of oldest note)
This can be a bit tricky. Did you look into event signaling (as
opposed to broadcasting)? Event signaling will do most of what you
need, I think? You basically get the cycling for free.
"real" samplers, and synths tend to go about this in a way that's a
bit more advanced. For starters they tend to check whether a incoming
note (say a C3) refers to a key that already has a sounding voice
linked to it and in that case cycle this sounding one instead of the
oldest one. They also tend to "protect" the lowest or highest note (or
both) and only cycle those voices when they have finished sounding or
when it's unavoidable to cycle them.
This is obviously a bit harder to implement but will keep how
objectionable "stolen" voices are to a relative minimum.
I've been wondering whether we couldn't use yet more advanced
strategies. For example we might want to protect the loudest currently
sounding voice in highly dynamic pieces more than the lowest (in
pitch) one. I could also imagine that in cases where some chord
involves multiple versions of the same note (like both A3 and A4) we
might prefer to cycle the A4 over the -let's say- G3 that might also
be sounding because dropping the A4 will likely be less audible.
To go yet more advanced; we might imagine a voice architecture where
voices themselves could detect when the most interesting sections of
their sound has finished and so put themselves "in the recycling bin"
I've been thinking about these things for a while now but typically I
don't compose for many voices myself, maybe some of this will be
useful to somebody who wants to get the most voices out of his/her
computer in the most efficient way.
> Any interest in me posting it on
> http://wiki.cs.princeton.edu/index.php/Chuck/Lib when it's more thoroughly
Of course! On the Forum there have been occasional questions about
polyphony/voice cycling, I'm sure your take on it will be helpful to
More information about the chuck-users