[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] updating arrays in Pbind



There are a number of ways you can do this.

The easiest would be to use a Plazy instead of a Pfunc, only problem is that the Plazy does not pass its event to the function currently.

so the other way is this:

// instead of a Pdef use a Pbindef

Pbindef(\myPdef,
		\midinote, 60,
		\dur, Pseq ([1,1],inf),
		\volu, Pseq ([1,1],inf),
		\bus, Prand ([0, 1],inf),
		\decay, Pseq([0.5,0.5],inf),
		\instrument, \sinew
)

// to set the note, you write:

Pbindef(\myPdef, \midinote, 67);
Pbindef(\myPdef, \midinote, Pseq([67, 70], inf));

(for more information see Pbindef helpfile)


At 12:12 Uhr +0100 07.06.2006, simon blackmore wrote:

A while ago a posted a question about dynamically controlling Pbind
and got this great response from Alberto.

Now I am trying to update an array rather than a single controller.
I have tried modifiying my working dynamic Pbind example (below)
but its not really working. Am I going down the wrong path with this.
Ideally I would like a flexible set up where some parameters are controlled
by midi and others by updating arrays.. All while Pbind is running along nicely.

Any thoughts.

Thanks
Simon

	// your synthdef
SynthDef("sinew",
{arg midinote = 60, amp = 0.9, dur = 1, bus=0, attack = 0,length =
0.25, decay = 0,volu = 1;
	var x;
	x = SinOsc.ar(midinote.midicps, mul: amp)
			*
			EnvGen.kr(Env.linen(attack, length, decay,
volu), doneAction: 2);

Out.ar(bus,x);
}).store;
)

	// a pdef with a silly name, use its environment
	// to store a value for the name \decay
Pdef(\myPdef).set(\midinote, 60);

	// put your pbind in that Pdef:
(
Pdef(\myPdef,
	Pbind(
		\midinote, Pfunc({|e| e.midinote}),
		\dur, Pseq ([1,1],inf),
		\volu, Pseq ([1,1],inf),
		\bus, Prand ([0, 1],inf),
		\decay, Pseq([0.5,0.5],inf),
		\instrument, \sinew
	)
);
)

Pdef(\myPdef).play;



	// My attempt which just plays two notes rather than one after another
Pdef(\myPdef).set(\midinote, ([66,70]),inf);

--





.