View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

How to loop over a couple of values?

Home   How To   Code Pool   Public Library   Theory   Events

using multiple controls


(
a = { arg values=#[0, 1, 1, 0, 1, 0, 1, 1, 0];
	var amp;
		amp = 0.1 * Select.kr(Stepper.kr(Impulse.kr(5), 0, 0, 7, 1), values);
		PinkNoise.ar(amp)
}.play;
)

a.setn(\values, [1, 0, 0, 0, 0, 1, 0, 1]);
a.setn(\values, [1, 0.5, 0.3, 0, 0, 0.1, 1, 1]);




using a buffer


b = Buffer.alloc(s, 8, 1, bufnum:156);
b.setn(0, [1, 0, 0, 0, 0, 1, 0, 1]);

(
a = {
	var amp;
		amp = 0.1 * BufRd.kr(1, 156, Stepper.kr(Impulse.kr(5), 0, 0, BufFrames.kr(156), 1));
		PinkNoise.ar(amp)
}.play;
)

b.setn(0, [1, 0.5, 0.3, 0, 0, 0.1, 1, 1]);




using single control and a client side task


a = { |amp| PinkNoise.ar(amp * 0.1) }.play;
b =  [1, 0.5, 0.3, 0, 0, 0.1, 1, 1];

fork {
   loop {
   b.do {|val|
      a.set(\amp, val);
      0.2.wait;
   }
   }
}

loop_values.rtf

Link to this Page