Here some test examples with a vst organ instrument, I adapted to Christof’s release of v0.1.0 (VSTPlugin v0.1.0 released!)
// VSTPlugin examples with patterns, using VSTPlugin vs 0.1.0
/////////////////////////////////////////////
1.) Download and install ComboV organ from
http://www.vst4free.com/free_vst.php?id=1004
2.) Boot SC with VSTPlugins
/////////////////////////////////////////////
Ex.1a straight usage, single synth instrument
(
// vsti with pan option
SynthDef(\vst, { |out = 0, pan = 0|
var sig = VSTPlugin.ar(nil, 1);
Out.ar(out, Pan2.ar(sig, pan));
}).add;
)
// start synth and controller
~synth = Synth(\vst);
~ctrl = VSTPluginController.new(~synth);
// insert your path
~ctrl.open("/Library/Audio/Plug-Ins/VST/ComboV");
// define patterns
(
p = Pbind(
\type, \midi,
\midiout, ~ctrl.midi,
\dur, Pwrand([0.3, Rest(0.3)], [0.8, 0.2], inf),
\legato, 1,
\midinote, Pxrand((80..95), inf)
);
q = Pbind(
\dur, Prand([2, 3, 5, Rest(3)] * 0.3, inf),
\midinote, Pxrand((48..60), inf)
) <> p;
r = Pbind(
\dur, Prand([1/2, 1/2, 1, Rest(1)] * 0.3, inf),
\legato, 0.5,
\midinote, Pxrand((62..78), inf)
) <> p;
)
// play voice by voice
x = p.trace.play(quant: 0.3)
y = q.trace.play(quant: 0.3)
z = r.trace.play(quant: 0.3)
z.stop
x.stop
y.stop
/////////////////////////////////////////////
Ex.1b panning with 4 running vst instruments
// 4 positions in space
~synths = [-0.75, -0.3, 0.3, 0.75].collect { |x| Synth(\vst, [\pan, x]) };
~vsts = ~synths.collect { |x| VSTPluginController(x) };
// insert your path
~vsts.do { |x| x.open("/Library/Audio/Plug-Ins/VST/ComboV") };
(
p = Pbind(
\type, \midi,
\midiout, ~vsts[1].midi,
\dur, 0.2,
\legato, Prand([0.3, 0.7], inf),
\midinote, Pxrand((62..78), inf)
);
q = Pbind(
\dur, Prand([2, 3, 5, Rest(3)] * 0.2, inf),
\midiout, ~vsts[2].midi,
\midinote, Pxrand((48..60), inf)
) <> p;
r = Pbind(
\dur, Prand([1/2, 1/2, 1, Rest(1)] * 0.2, inf),
// LL RR scheme
\midiout, Pseq([0, 0, 3, 3], inf).collect { |x| ~vsts[x].midi },
\midinote, Pxrand((80..93), inf) + [0, 5]
) <> p;
)
// play voice by voice
x = p.trace.play(quant: 0.2)
y = q.trace.play(quant: 0.2)
z = r.trace.play(quant: 0.2)
x.stop
y.stop
z.stop
/////////////////////////////////////////////
Ex.2 setting vst instruments with event type set
// SynthDef, does pitchbend on all pitch classes (index inof see below)
(
SynthDef(\vst_pb, { |out = 0, pitchBend = 0.5, pan|
var sig = VSTPlugin.ar(
nil,
1,
params: ([(11..22), pitchBend ! 12]).flop.flat
);
Out.ar(out, Pan2.ar(sig, pan));
}).add;
)
// start 2 synths
~synths = { Synth(\vst_pb) } ! 2;
~ctrls = ~synths.collect { |x| VSTPluginController(x) };
// insert your path
~ctrls.do { |x| x.open("/Library/Audio/Plug-Ins/VST/ComboV") };
// info:
// ~ctrls[0].info.parameterNames.postcs
(
// 2 patterns set params of the 2 synths
p = Pbind(
\type, \set,
\id, ~synths[0].nodeID,
\args, [\pan, \pitchBend],
\dur, 0.2,
\pitchBend, Pxrand([0.25, 0.5, 0.75], inf),
\pan, Pxrand([-1, -0.5, 0, 0.5, 1], inf)
);
q = Pbind(\id, ~synths[1].nodeID) <> p;
// 2 patterns set notes via midi
r = Pbind(
\type, \midi,
\midiout, ~ctrls[0].midi,
\legato, 2,
\dur, Pwrand([2, 3], [0.8, 0.2], inf),
\midinote, Pxrand((48..90), inf)
);
t = Pbind(\midiout, ~ctrls[1].midi) <> r;
)
// run all, do a bit of midi delay compensation
x = Ptpar([0.02, p, 0.02, q, 0, r, 0, t]).play
// cleanup
// wait for release
x.stop
// when silent stop synths
~synths.do(_.free)