(alpha) VSTs in scsynth?!

Reposting from sc-users – as far as I can see, this code is in its infancy (needs testing, not ready for production use), but I would like to see this work out, as a bridge for people who are interested in algorithmic composition but don’t necessarily want to become experts in synthesis.

Complete e-mails:

(To clarify, I am only forwarding this information. I use Linux, so I can’t try it myself and I am not a contact person for any issues. If you try it and run into problems, you should track down Christof directly (or post on the sc-users list). Christof is not following the forum and he won’t be able to answer any bug reports here.)

hjh

From Christof Ressi:

hi, I’ve been developing a Pure Data external for loading VST plugins (Pure Data libraries / vstplugin · GitLab) and it has been working quite well so far. Now here’s my first attempt at porting it to SuperCollider:

Here’s the repo:

https://git.iem.at/pd/vstplugin/tree/supercollider2

Here are the test binaries:

~~Windows (64 bit): https://drive.google.com/open?id=1altTlQG-d6Owv2Q_m0WqsU6oK8iNX_bD
macOS: https://drive.google.com/open?id=1RuH8l-jWPpnrs79L0cmsR5F0Xbwd2O-A~~

UPDATE:

Here’s the source: Files · develop · Pure Data libraries / vstplugin · GitLab
Windows binaries (64 bit): VstPlugin-win64.zip - Google Drive
macOS binaries: https://drive.google.com/open?id=1U7r5NmHu30sk-hnFYKTt23V1TeRqt_so

2 Likes

This is so great !!

I could make the alternate version work.

Here is an example with MDA ePiano VST on Mac OS X.

VstPlugin.makeSynthDef.add;
~vst = VstPlugin.new([\nin, 0, \nout, 2, \out, 0, \replace, 0], s, addAction: \addToHead);
~vst.open("/Library/Audio/Plug-Ins/VST/mda ePiano.vst", info: true);

(
Event.addEventType(\vstPlugin, { |server|
	var notes = [
		~midinote.value,  // 0
		~ctranspose.value,  // 1
		~velocity.value, // 2
		~sustain.value, // 3
		~lag.value, // 4
		~timingOffset.value, //5
		~instrument, // 6
		~midiChannel.value, // 7
	].flop;
	var timeNoteOn, timeNoteOff;

	notes.do { |note|
		// sustain and timingOffset are in beats, lag is in seconds
		timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;
		timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;

		SystemClock.sched(timeNoteOn, {
			note[6].midiNoteOn(chan: note[7] ? 0, note: (note[0]+note[1]).asInteger, veloc: note[2].asInteger.clip(0,127));
		});
		SystemClock.sched(timeNoteOff, {
			note[6].midiNoteOff(chan: note[7] ? 0, note: (note[0]+note[1]).asInteger, veloc: note[2].asInteger.clip(0,127));
		});
	}
});
)

(
Pbind(*[
	type: \vstPlugin,
	instrument: ~vst,
	dur: 4,
	degree: [0, 4],
	velocity: 64
]).play;
)

// straight timing
(
Pbind(*[
	type: \vstPlugin,
	instrument: ~vst,
	legato: Pgauss(0.2,0.05,inf),
	dur: 0.2,
	degree: [2,5,12],
	ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),
	velocity: Pgauss(64,10,inf),
]).play;
)

// loose timing
(
Pbind(*[
	type: \vstPlugin,
	instrument: ~vst,
	legato: 0.1,
	dur: 0.2,
	midinote: [66, 69, 74],
	lag: Pwhite(-0.05!3, 0.05)
]).play;
)

2 Likes

Christof has made a new version for us to test !

Hi, I've made some changes to the design of VstPlugin to make it more flexible. These are the major improvements:

* VstPlugin is no longer a subclass of Synth
* VstPlugin UGens can now be freely instantiated and connected in SynthDefs
* VstPluginController is used to control a specific VstPlugin instance in a Synth
* VST plugin parameters can now be modulated via UGen arguments

Thanks to the community for the helpful feedback!

Looks like the only thing left to do make opening/closing plugins and reading/writing preset files realtime-safe.

Here's the source: https://git.iem.at/pd/vstplugin/tree/develop
Windows binaries (64 bit): https://drive.google.com/open?id=15rxPZLPLdIfQU6nokcQu2GrDBxW_ld9n
macOS binaries: https://drive.google.com/open?id=1U7r5NmHu30sk-hnFYKTt23V1TeRqt_so

Please test!

Christof

hi @jamshark70, thanks for forwarding this to the forum, I just stumbled across this by accident :-). since the initial test versions are already obsolete, can you make an EDIT to the original post pointing to the more recent version posted by Geoffroy above? and I’m part of the forum now, so people can ask me things.

cheers, Christof

OK, done, used strikeout for the old links.