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

[sc-users] re: updating arrays in Pbind



Thanks Julian that works well,

is there a
way of controlling each value of the array dynamically I am
working on a project which is getting osc messages from
Processing. Really I am looking for the most efficient way to
update Pbind.

what I would do is to write those values to the arrays directly:


Pdef(\myPdef).set(\durArray, [1, 1]);

Pdef(\myPdef,
	Prout { |e|
		Pbind(
			\midinote, 60,
			\dur, Pseq (e.durArray, inf),
			\volu, Pseq ([1,1],inf),
			\bus, Prand ([0, 1],inf),
			\decay, Pseq([0.5,0.5],inf),
			\instrument, \sinew
		).embedInStream(e)
	}
);

Pdef(\myPdef).play;

now you simply write to the array:

Pdef(\myPdef).envir.durArray[1] = 0.2;

if you want to change anything more substantial, you can still do that with say:
Pbindef(\myPdef, \dur, Pseq([0.1, 0.2, Pseq([q.durArray])], inf));

(you can of course also use a global envir to access your values.)



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)



_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users

--





.