Fading a multichannel Pdef

So I am stuck with (multichannel) fading a Pdef…

I have a multichannel GrainBuf instrument which is controled by the following Pdef.
This Pdef should fade between the several buffer arrays (like stated in the Pxrand) so that a continous (generative and endless) drone is created.
I then unsuccessfully tried to achieve this with a loop inside a Tdef. There are always gaps inbetween… While reduced approaches do work like expected, I guess it has something to do with the multichanneling or do I even need a Pdef/the Pdef-Tdef-combination? I also made sure that every soundfile has no blank beginnings and ends to avoid the playback head moving through those…

The available posts in here didn’t helped me much, so I decided to start a new one…

Thank you!!

Pdef(\drone_pdef).fadeTime = 4; // has to be lower than ~pwhiteLo

~pwhiteLo = 7.0;
~pwhiteHi = 12.0;

// Tdef for endless fading
Tdef(\drone_tdef, {
		Pdef(\drone_pdef, Pbind(

			\instrument, \drone_synth,

			\dur, Pwhite(~pwhiteLow, ~pwhiteHi, inf),

			\envDur, Pwhite(~pwhiteLow, ~pwhiteHi, inf),

			\sndbuf, Pxrand([
				[~b1_a, ~b2_a, ~b3_a, ~b4_a, ~b5_a],
				[~b1_e, ~b2_e, ~b3_e, ~b4_e, ~b5_e],
				[~b1_i, ~b2_i, ~b3_i, ~b4_i, ~b5_i],
				[~b1_o, ~b2_o, ~b3_o, ~b4_o, ~b5_o],
				[~b1_u, ~b2_u, ~b3_u, ~b4_u, ~b5_u]
			], inf),

			\grainPosDur, Pwhite(~pwhiteLow, ~pwhiteHi, inf),

			\amp, -12.dbamp

// This here works...
Pdef(\a).fadeTime = 1.5;

Tdef(\a_seq, {
		Pdef(\a, Pbind(\dur, 0.2, \degree, Pxrand([Pseq([0], inf), Pseq([4], inf), Pseq([7], inf)], inf)));

I am not totally sure I understand what you are after without seeing the synthdefs…

They easiest way is probably to use an envelope inside the synth with some release time and let the previous synth fade out (when it receives a gate = 0) while the next one is fading in - just like playing a normal synth.

// supply two mono buffers fro ‘a’ and ‘b’

SynthDef(\gran, {
	var sig = GrainBuf.ar(1, Impulse.ar(1), 3, sndbuf: \buf.kr(#[0, 0]), rate:1, pos:0);
	var env = Env.asr(0.01, 1, 3).kr(2, \gate.kr(1));
	Out.ar(0, sig * env!2)

 		\instrument, \gran,
		\buf, Pxrand([[a, a], [b, b]], inf).trace, 
		\dur, 2


Not quite sure what you are asking.

You can not fade between buffers, however, you could change the distribution of the buffers used by the grains by using a weighted distribution…

(for an example)

\buf_fade, Pseries(0, 0.01, inf).wrap(0, 1),
\buf, Pwrand([~b1, ~b2], Pkey(\buf_fade) - [0, 1]) 

Sorry for the confusion, next time ill post my SynthDefs with it…

Yeah it was an Envelope related thing, thank you!

I was using an Env in my Synth like this one where envDur was also a key in the Pbind:

env = Env([0, 1, 1, 0], [0.05, 0.15, envDur, 1.0], ['wel']).kr(2);

I do know how a gate works but I don’t understand the implications when providing such just with a default value of 1 inside a SynthDef/Envelope…

Until now I just didn’t had enough use cases where I needed a gate, but maybe this changes from now…