PbindFx Pan2 and Pkey(\delta)

I have two questions with PbindFx:

1.) I´m using a Pan2.ar in the source and get the following Error. When i leave it out its working. What has to be done here?

INPUT ERROR in building an instance of nil:

    PbindFx bus mismatch, source and fx synths must match in/out conventions: 

    .) 	For source and fx SynthDefs there must be only one out ugen using 'out' as bus arg, 
    	LocalOut is allowed, other out ugens can be admitted by \otherBusArgs. 
    .) 	Source SynthDefs must not have in ugens, except LocalIn or 
    	they are admitted by \otherBusArgs.  
    .) 	Fx synths must read from buses with ugen In.ar(in, ...) refering to the bus arg 'in', 
    	there must not be other in ugens within the fx SynthDef, 
    	except LocalIn or they are admitted by \otherBusArgs.
    .) 	Number of out channels of preceeding source / fx synth must not be greater than 
    	the number of the following fx synth's in channels,
    	this is checked for all connections of an fx graph.

2.) I´m using a Comb Filter for the Fx and would like to have the \decay argument of the fx in depency of the \delta value of the source to emphasize a cadence and was trying:

\decay, Pif(Pkey(\delta) == 4, 4, 1)

But Im not sure if its working when i use .trace I only see the value 1 in the Post Window even if Pif(Pkey(\delta) == 4.
thanks

Hi,

ad 1 ) Difficult to say without source code. The size of the source out could be wrong, a stereo signal, to which dup is applied or something like that. Or the fx doesn’t eat stereo.

ad 2) This is a common mistake with Pif and has nothing to do with PbindFx, e.g. see

hey, thanks @dkmayer for the help.

1.) will double check the .dup value. thanks.

2.) For implementing a condition in the source its working:

\inputA, Pseq([0,1],inf), //Crackle 0, PinkNoise 1, BrownNoise 2
\rotateFreq, Pif(Pbinop('==', Pkey(\inputA), 1), 1/10, 1/50),  //change Rotate2.ar Speed when PinkNoise is selected for inputA 

but when I use it for a condition between source and fx i get no sound at all:

//source:
\delta, Pseq([4, 1.5], inf),
//fx:
\decay, Pif(Pbinop('==', Pkey(\delta), 4), 4, 1),

Here is the complete PbindFX:

(
Pdef(\FFT_crackle_hi,
	PbindFx([
		\instrument, \FFT,

		\freq, 25,
		\chaos, 0.25,

		\inputA, Pseq([0,1],inf), //Crackle 0, PinkNoise 1, BrownNoise 2
		\inputB, Pseq([0,1],inf), //Pulse 0, Dust 1, LFSaw 2

		\legato, Pwhite(0.8,1.0,inf), // default: 0.8 -> dur: delta * 0.8
		\delta, Pseq([4, 1.5], inf),
		\overlap, 1,

		\atk, 0.1, // between 0 and 1
		\sus, Pxrand([0.2,0.7],inf), // between 0 and 1

		\env, Pfunc{|e|
			var tempo = thisThread.clock.tempo;
			var dur = (e.delta * e.overlap);
			var sus = (dur - e.atk) * e.sus;
			var rel = (dur - e.atk - sus);
			var c1 = exprand(2,6);
			var c2 = exprand(-2,-6);
			[Env([0,1,1,0],[e.atk,sus,rel],[c1,0,c2])]
		},

		//abrasive pulses
		\a, 0.75,
		\b, -0.56,
		\d, 0.99,
		\c, 0.67,

		\limitType, Pxrand([1,2],inf), //tan 0, softclip 1, distort 2

		\rotateFreq, Pif(Pbinop('==', Pkey(\inputA), 1), 1/10, 1/50),

		\amp, 0.25,

		\fxOrder, [1]
	], [
		\fx, \combL,
		\mix, 0.5,
		\amp, 1,
		\delHz, 0.55,
		\delMin, 0.25,
		\delMax, 0.75,
		\decay, 1,
		//\decay, Pif(Pbinop('==', Pkey(\delta), 4), 4, 1),
		\cleanupDelay, Pkey(\decay)
    ]),
).play(t, quant:1);
)

Ah, I see, Pkey isn’t applicable here as source and fx patterns have different name spaces. You’d have to do data sharing, e.g.

//source:
\delta, Pseq([4, 1.5], inf).collect { |x| ~d = x },

// or shorter with partial application
// \delta, Pseq([4, 1.5], inf).collect (~d = _),

//fx:
\decay, Pfunc { (~d == 4).if { 4 }{ 1 } },
1 Like

thanks, its working and sounding great :slight_smile:

one last one:

how do i implement: if \inputA is 1 or 2 instead of just 2?

\inputA, Pseq([0,Pxrand([1,2])],inf), //Crackle 0, PinkNoise 1, BrownNoise 2
\rotateFreq, Pif(Pbinop('==', Pkey(\inputA), 2), 1/10, 1/50),

I’d generally switch to if statements with Pfunc, it’s more versatile:

E.g.
(untested)

Pfunc { |e| [1, 2].includes(e[\inputA]).if { 1/10 } { 1/50 } }

thanks for the tip. its working great :slight_smile: