// title: control patterns via control bus // author: Luka P. // description: // a learning example where you can control patterns with running ugens via control bus. acid-like. // code: ( SynthDef(\acid, { arg out, freq = 1000, gate = 1, pan = 1, cut = 4000, rez = 0.8, amp = 1, sustain = 1, release = 0.5; var sig, env; env = EnvGen.kr(Env.linen(0.01, sustain, sustain * release), gate, amp, doneAction: Done.freeSelf); sig = Pulse.ar([freq,freq*1.001], 0.5); sig = sig + Pulse.ar(freq*0.501, 0.01, [0,0.5]); sig = sig + Pulse.ar(freq*1.99, 0.11, [0.5,0]); sig = RLPF.ar(sig, cut, rez); sig = Pan2.ar(sig); sig = sig * env; Out.ar(out, sig); }).add; ) ~bus = Bus.control(s,1); ~bus2 = Bus.control(s,1); ( ~lfo1 = SynthDef(\lfo1, { arg fmin=200, fmax=2000; Out.kr(~bus, SinOsc.kr(0.1).range(fmin,fmax)) }).play; ~lfo2 = SynthDef(\lfo2, { arg fmin=1, fmax=3; Out.kr(~bus2, SinOsc.ar(0.05).range(fmin,fmax)) }).play; Pbind(\instrument, \acid, \note, Pfunc{~bus2.getSynchronous * 2}, // !! \cut, Pfunc{ ~bus.getSynchronous }, // !! \dur, Pseq([0.08, 0.2, 0.1, 0.03, 0.08, 0.2, 0.12], inf), // uncomment for an extreme example: //\dur, Pfunc{ ~bus2.getSynchronous.linlin(1,3,5,1) * 0.035 }, \legato, 0.3, \release, 2, \root, -30, \pan, Pfunc({0.5.rand2}), \rez, Pfunc({0.7.rand +0.3}), \amp, 0.2).play; ) // now you can change some parameters of the LFOs in the control busses ~lfo1.set(\fmax, 800) ~lfo1.set(\fmin, 90) ~lfo2.set(\fmax, 3) ~lfo2.set(\fmin, 1)