VstPlugin pre-release (outdated)


#21

What I have is a legacy product:
https://www.waves.com/downloads/v9


#22

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)

VSTPlugin + MIDI event patterns: velocity?
VSTPlugin v0.1.0 released!
#23

we should really collect examples like these for a VSTPlugin Guide/Tutorial!


#24

Thanks for the clarification, Christof, and for VSTPlugin itself – you’ve done us all a great service!

Thank you as well, Daniel, for your thorough response. I look forward to trying it out when I get home this evening. I was able to send midi note messages last night after Christof clarified the syntax for me, but was still unable to send cc messages. Looking over your examples, I think I had just left out the params args in the SynthDef and should be able to get it to work by following your pitchbend example.


#25

VSTPluginMIDIProxy internally calls VSTPluginController-sendMidi, which in turn sends the raw MIDI message to the VSTPlugin UGen. the params argument is not related as it’s used for automating parameters via UGens.

regarding CC: PBind(\type, \midi, ...) sends MIDI noteOn messages by default but you can change the message type with the \midicmd argument.
http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_Cookbook04_Sending_MIDI.html
In your case try: PBind(\type, \midi, \midicmd, \control

EDIT: are you sure you need CC messages? if you just want to set plugin parameters via patterns, you can indeed use params + a PBind of type\set. Or make your own Event type which calls VSTPluginController-set. I think @Geoffroy had an example, maybe he can update it to the new version?

EDIT: and maybe continue here VSTPlugin v0.1.0 released!


#26

Thanks again, Christof.

I’m familiar with \midicmd, \control, and use it regularly with standalone apps, but something isn’t working for me here. Here’s the code I’m running – does anything appear to be amiss? I’m able to manipulate parameters via the interface and with UGens, but not the Pbindef. I’m also able to send note messages to a vsti, but it crashes after a minute (gui disappears and synth goes silent). I’m also seeing a horizontal white bar that blips onto my screen for maybe a couple milliseconds.

~conbus = Bus.audio(s, 2);

SynthDef(\contrast, {Out.ar(0, VSTPlugin.ar(In.ar(~conbus, 2), 2))}).add;

~consynth = Synth(\contrast);

~contrast = VSTPluginController(~consynth);

~contrast.open("/Library/Audio/Plug-Ins/VST/GRM/GRM Contrast Stereo.vst/", info: true);

~contrast.gui;

Pbindef(\weak, \type, \midi, \midicmd, \control, \midiout, ~contrast.midi, \chan, 0, \ctlNum, 4, \control, Pn(Pseries(0, 1, 99)), \dur, 0.25).play;


#27

Just saw the white bar while not running VSTPlugin, so that’s unrelated.


#28

@robertf generally, ~fx.midi.control itself is working. can you open an issue on the issue tracker describing the problem? https://git.iem.at/pd/vstplugin/issues
it’s hard for me to track complex issues when they are interleaved with other posts. I need as much info as possible, describing exactly what you try to do (e.g. which plugin(s), where to get it, which CC messages, what’s the intended result, etc.) thanks!


#29

Some new examples also with vst fx and including LFO control: