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

Re: [sc-users] driving parameters with enveloppes in patterns



and i'd like to add 2 other options to consider...

1. code the 'oscillators' or envelopes yourself in sclang. a good exercise.

(
a= 2;	//freq
p= Pbind(
	\dur, 0.125,
	\freq, Proutine({
		var amp= 1;
		360.do{|x|
			var y= sin(x/360*a*2pi)*amp;
			y.linexp(-1, 1, 400, 800, nil).yield;
		};
	})
).play;
)
a= 5
a= 10
a= 90
a= 91


2. look into SharedOut. there's also SharedIn if you ever need to control some synth parameter from a pbind.

s= Server.internal;	//sharedout only works with internal server
s.boot
(
a= SynthDef(\shared, {|freq= 0.5|
	SharedOut.kr(0, SinOsc.kr(freq));
}).play(s);
p= Pbind(
	\dur, 0.125,
	\freq, Pfunc({s.getSharedControl(0).linexp(-1, 1, 400, 800, nil)})
).play;
)
a.set(\freq, 0.1)
a.set(\freq, 10)
a.set(\freq, 5)
a.set(\freq, 6)
a.set(\freq, 4)



_f


16 mar 2009 kl. 17.41 skrev James Harkins:

The trick is, getting a value from a control bus is asynchronous but
the Pfunc's function has to return its value synchronously.

kr bus <===> Pfunc won't work, but...

kr bus ===> (storage in client) <=== Pfunc will work beautifully.

The storage could be a declared variable, environment variable or
maybe another structure to handle multiple values.

I often use my GenericGlobalControl for this - it's a client-side
wrapper of a kr bus on the server, with "watch" capability to update
the client-side value automatically.

g = GenericGlobalControl(\myThing, nil, 0, controlSpec);
g.watch;

// Change update frequency with:
KrBusWatcher.newFrom(s).updateFreq = timesPerSecondToUpdate;

It's in the ddwCommon quark.

Oh, GenericGlobalControls respond to asStream so you can use them
transparently in patterns.

Pbind(\g, g)

hjh

On Mon, Mar 16, 2009 at 12:05 PM, Josh Parmenter <josh@xxxxxxxxxxxxxxxxx > wrote:
When in doubt, PFunc is always the answer (though I still think it should be
spelled with a 'k' a la George Clinton)

I recall felix saying once "that's why I make my func the P-func"


  #|
     fredrikolofsson.com     klippav.org     musicalfieldsforever.com
  |#


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/