Accessing Pbind Key in If Statement

Hi, I would like to use the values in key \b to influence the values in key \a using an if statement. However, it appears that the if statement does not understand \b as a variable. How would I reference the key?
I tried storing the stream in a variable and calling it but no luck either.

(
a = Pseed(Pn(1000,1),Pwrand([100,50],[0.5,0.5],32));
x = a.asStream;


Pbind(
	\instrument,\default,
	\a,Pfunc{
		if(x == 50)
		{10}
		{1000}
	},
	\b,x.trace,
	
).play;
)

Thanks, MJ

Figured it out - ( And I’d actually solved this before ). Key orders matter plus I need to step through the results…

(
a = Pseed(Pn(1000,1),Pwrand([100,50],[0.5,0.5],32));
x = a.asStream;

Pbind(
	\instrument,\default,
	
	\b,x,
	
	\a,Pfunc{ |i|
		(i [\b] == 50).if
		{10}
		{1000}
	}.trace,
	
	
).play;
)
1 Like