[sc-users] access arguments in array

Stephen Lumenta lfanele at gmail.com
Tue Dec 5 17:40:16 PST 2006


Hi,
thanks! this does point in the right direction, still i wonder if it  
is possible to just set/access a single value in the whole array.  
Array.put(n, value) doesn't work with setn.
Stephen

Am 05.12.2006 um 15:02 schrieb Till Bovermann:

>
> Atm, you only have one freq for all Sines. You have to set up an  
> array of controls like it is done in the last Example of the  
> DynKlank-helpfile (slightly modified here):
>
>
> (	// create multichannel controls directly with literal arrays:
> SynthDef('help-me', {| freqs (#[100, 200, 300, 400]),
> 	amps (#[1, 0.3, 0.2, 0.05]),
> 	rings (#[1, 1, 1, 2])|
>
> 	Out.ar(0, DynKlank.ar(`[freqs, amps, rings], WhiteNoise.ar * 0.001))
> //	Out.ar(0, SinOsc.ar(freqs, amps))  // uncomment this line for  
> your sines...
> }).send(s)
> )
>
> then you may set the whole array of freqs via setn messages:
>
> a = Synth('help-me');
>
> a.setn(\freqs, Array.rand(4, 500, 2000));
> a.setn(\amps, Array.exprand(4, 0.01, 1));
>
> note that you have to determine the size of the arrays at SynthDef- 
> send-time.
>
> hope that helps
> Till


More information about the sc-users mailing list