[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] Control Bus management
I changed your example a little bit to give a clear example of how two sliders and control busses can be used... the top controls amp, the lower slider is the freq of a SinOsc. Also, the second control bus is initialized to a value.
Also, avoid this
Out.ar([0, 1], sound)
Do this;
Out.ar(0, [sound].dup(2)); // duplicate the array... outputs 2 channels
Or use a Pan UGen
Hope this helps.
Josh
(
\trig,
{arg amp=1.0, gate = 1, density, freq;
var dur, sound;
dur = Rand(0.01, 0.05), Rand(0.01, 0.05), 1), 1.0, doneAction:2);
sound = SinOsc.ar(freq, 0, amp);
Out.ar(0, [sound].dup(2) * dur);
}).send(s)
)
(
var w, slider, slider2;
c = Bus.control(s,1);
d = "c" ++ c.index;
e = Bus.control(s, 1); // a new control bus
f = "c"++e.index;
// set an initial value on the Control Bus
e.value_(220);
w="Instr1", Rect(100,500,200,135));
slider=Rect(10,10,180,30));
slider.action_({c.set(slider.value);});
slider.value_(0);
slider2=Rect(10,60,180,30));
slider2.action_({e.set((slider2.value * 220) + 220);});
w.front;
)
(
r = Task({
{"trig", [\density, rrand(0.5, 11),
\freq, f,
\amp, d
]);
rrand(0.1, 1.0).wait;
}.loop;
}).play
)
r.stop;
******************************************
Joshua D. Parmenter
http://homepage.mac.com/joshpar/
"...Some people think a composer's supposed to please them, but in a way a composer is a chronicler... He's supposed to report on what he's seen and lived."
-Charles Mingus
On Aug 31, 2005, at 8:15 AM, Ricardo Guerreiro wrote:
Hello,
This works, but I don't know what to do to use more than one control Bus of this kind.
I red the Bus.help.rtf ("Manages allocation and deallocation of bus indices so that you don't need to worry about conflicts.") and tryied to change some variable names...
What would you recomend? (I mean, not just to solve the problem, but to really understand what am I missing - for sure a lot of different things...).
Thanks again.
(
\trig,
{arg amp=1.0, gate = 1, density, freq;
var dur, sound;
dur = Rand(1.5,6), Rand(1.5,6), 1), 1.0, doneAction:2); sound = Dust.ar(density), 0.002) * SinOsc.ar(freq, 0.5);
x = sound * Env.cutoff, gate, doneAction: 2);
Out.ar([0,1], x*amp*dur);
}).send(s)
)
c = Bus.control(s,1);
d = "c" ++ c.index;
(
var w, slider;
w="Instr1", Rect(100,500,200,65));
slider=Rect(10,10,180,30));
slider.action_({c.set(slider.value);});
w.front;
)
(
r = Task({
{"trig", [\density, rrand(0.5, 11),
\freq, rrand(1, 100),
\amp, d
]);
rrand(3.0, 6.0).wait;
}.loop;
}).play
)
r.stop;_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users