An array would be a good upgrade here:q = Array.fill(4, {Bus.control(s, 1)});Then you can refer to the buses as q[0], q[1], etc.cheers,jOn Jan 16, 2014, at 1:11 AM, Dan Palkowski <in...@meetup.com> wrote:
Your Organizer, Dan Palkowski, sent the following message to some members of New York SuperCollider (SC3) Meetup:
voila:
s.boot;
MIDIIn.connectAll;
//test synth
SynthDef(\testSyn, {|out, freq=200, amp = 0.1, dur = 10.0, filt = 1000.0, res = 0.1|
var env = EnvGen.kr(Env.perc(Rand(0.01,0.5), dur*Rand(0.1,1.0), 1, -8), doneAction:2)*amp;
out = RLPF.ar( Saw.ar(freq, amp),filt, rq: res)*env;
Out.ar([0,1], out);
}).add;
(
n = MIDIFunc.noteOn ({ | val, num, chan, src | a = Synth("testSyn", [\freq, num.midicps]);num.postln});
o = MIDIFunc.noteOff({a.release});
q = Bus.control( s, 1);
r = Bus.control( s, 1);
t = Bus.control( s, 1);
u = Bus.control( s, 1);
)
n.free;
o.free;
//test for specific incoming controllers, apply specs to each, map parameter (determined by placement in args list)
(
x =MIDIFunc.cc({ | val, num, chan, src |
case
{num == 0}
{q.set(val.midicps);
a.map(1, q)}
{num == 1}
{r.set((val+1.0)/127);
a.map(2, r)}
{num == 2}
{t.set(0.1*(val+1.0));
a.map(3, t)}
{num == 3}
{u.set(100.0*(val+1.0));
a.map(4, u)};
[val, num, chan, src].postln
});
)
[x,a,n,o,q,r,t,u].free;To visit New York SuperCollider (SC3) Meetup, go here:
http://www.meetup.com/nyc-supercollider/To manage your email settings, click hereStart a Meetup in January and save 50%! http://www.meetup.com/create/
--
You received this message because you are subscribed to the Google Groups "nycsupercollider" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nycsupercollid...@googlegroups.com.
To post to this group, send email to nycsuper...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nycsupercollider/CABVmqUPEnPvy-SL5PBWRP%3Deq7jJU%2BWBCG2D_1s-mugBm7XGbmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.