To handle this problem, you need to understand event types.
Pbind / Pbindef etc. don’t play anything. They just provide data. It’s up to the event prototype (usually Event.default
) to interpret the data and take action. The default event prototype defines a set of functions, called event types, to do different things.
If you don’t specify an event type, \note
will be used. This event type plays a new synth, and schedules its release. Notes may overlap, so a \note
-type Pbind sequence can be polyphonic.
Also be aware that nothing tracks these notes. They are launched, and run under their own power, but there’s no ongoing record in the language of which notes are playing what.
To respond to parameter changes, those parameter changes have to be directed to the active note(s) – not the pattern. Pbindef(\ptry3, \amp, 0);
means \amp
will be 0 for the next event in the sequence.
A simple way to do that is to put synths in a group. Then you can address parameter changes to the group, and it will affect all synths in the group. (Also, if you want notes to release early, use a gated envelope instead of hardcoding time.)
(
Tdef(\loopa, {
var group = Group.new;
loop {
3.wait;
Pbindef(\ptry3, \group, group).play;
10.wait;
group.set(\amp, 0);
5.wait;
group.set(\amp, 0.7);
10.wait;
Pbindef(\ptry3).stop;
group.freeAll;
// you've already got a 'loop {}'...
// this looks redundant
// Tdef(\loopa).reset.play;
}
}).play; // close braces on their same level
)
(This doesn’t release groups after stopping the Tdef… but I’m out of time for now.)
The ddwVoicer quark provides a node-tracking object, which would also work for this, but I can’t write up an example right now.
hjh