I’d like to use fadeTime to crossfade between \key changes inside a Pdef or Pbindef - for instance, to fade the pattern out from \amp, 0.5, to \amp, 0, without changing any other parameter of the pattern. And then be able to fade the pattern back in using the same procedure.
So far, I can only get this to work consistently when I redefine the entire Pdef, and not when I target single \key pairs with Pbindef.
In the code below, the first Pbindef fades the pattern to \amp, 0 over 5 seconds as expected.
But the second Pbindef sets the \amp to 0.5 immediately as if the fadeTime is no longer there.
Why is this? And how can I get the Pbindef changes to always have the fadeTime?
This question describes an understandable demand, but there is a tricky background involving two blocks of questions.
What do you actually (technically) expect ?
Should the values of the Pbind-generated synths be changed from event to event, should this happen ‘totally’ gradually in the sense that amp is mapped to a bus so that amp is diminished for every event? Depending on the answer different solutions would be possible. As you have been involved, I mention this related thread for others: Continuous Panning of Multiple Pbind Nodes?
How to deal with the question in combination with Pdef / Pbindef
It could be that fading Pdefs doesn’t do what you expect.
See this example:
Pdef(\y).fadeTime = 5;
// do fade, a second player is added !
Pbindef(\y, \freq, 700);
So when “fading out the amp” we are crossfading chords of same pitches where one has amp 0 !
I’m not a JITLib expert but I am not aware if generating a Pdef and then treating it as Pbindef for fading (though possible as they share the same namespace) is an intended usage. There are no fading examples in Pbindef help !
The fading examples I see in the help refer to Pdef sources, so you could do this:
Thanks a lot, Daniel. I’ll look more at Pchain, as you suggest, in combination with Pdef.
I think I’ll also ask about Pbindef fadeTime examples on the mailing list. I can see that Pbindef inherits the fadeTime method from Pdef, but as you say, there are no examples in the helpfile.
Regarding what to technically expect, my understanding is that the fadeTime crossfades two players as you point out. That’s fine for my purposes at the moment. But I don’t understand why it doesn’t do this consistently with Pbindef - why it does it once, but not a second time. It could have something to do with the mixing of Pdef and Pbindef as you mentioned…