Hey Christof
Honestly, this is really awesome, I was really eager to see VST(i) integration into SC and you made it !!! Thank you so much !
I've tried the alternative version and here are a few thoughts, please ignore if it is not relevant :)
I use SC 3.10 on a Macbook Air running Mac OS X 10.12
1. I was surprised that VstPlugin.new returns a Synth, and not a SynthDef.
Usually, in Supercollider, an instrument is represented by a SynthDef, and you create a Synth for each note or layer of polyphony.
I totally understand why you chose to map an instance of a VST plugin to a Synth, the drawback is that the VST instance is killed when using cmd + period to stop all the patterns and hence getting
VstPlugin freed!
2. I am getting a lot of late messages when sending MIDI notes to VSTi, even if my server latency is the standard 0.2 seconds.
late 0.023258091
However, this is really cool and for people who want to try it with patterns, here is an example :
(
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];
timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4];
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;
)
Thanks a lot !
Geoffroy