The array class offers numerous methods for creating
arrays, including fill():
c=Array.fill(4,{argi;10/(i+1)});
Arrays of Buses
Especially in multichannel projects and larger mixing setups,
arrays of buses can be helpful. Make sure to boot the server to
actually use (scope) the buses:
// an array of 16 buses, each with 4 channels:~busArray=Array.fill(16,{Bus.control(s,4)})// scope the second bus in the array:~busArray[1].scope// set the third bus of the second bus in the array:~busArray[1].setAt(2,0.5);
Array of Nodes/UGens
The same array approach can be used to generate multiple nodes,
for example sine waves at different frequencies and amplitudes:
// an array of 16 sine oscillators:~sineArray=Array.fill(16,{argi;{SinOsc.ar(200*i)}.play})
Array of Synths
The previous example can also be used with SynthDefs,
which is a good starting point for additive synthesis:
// a simple synthdef(SynthDef(\sine,{|f=100,a=1|Out.ar(0,a*SinOsc.ar(f));}).send(s);)~busArray=Array.fill(16,{argi;Synth.new(\sine,[f:200*(i+1),a:0.2])})