I’m having some trouble with this. Any ideas?
I am trying to make a VST plugin ripper that plays all midi notes and records them using a pattern. I’ve tried to follow the tutorial in the help file but this just results in a silent .wav file. Any ideas?
VSTRipper {
var <vst, vstSynth;
var server;
var <score;
*new{|numChannels=2, sampleRate=96000|
^super.new.init(numChannels, sampleRate)
}
init{|numChannels, sampleRate|
server = Server(\vstrippernrt,
options: ServerOptions.new.sampleRate_(sampleRate)
.numOutputBusChannels_(numChannels)
);
SynthDef.new(\my_vstinstrument, { arg out;
Out.ar(out, VSTPlugin.ar(nil, 2, id: \vsti));
}).store;
vstSynth = Synth.basicNew(\my_vstinstrument, server);
vst = VSTPluginController.new(synth:vstSynth, id: \vsti);
}
render{|path, pluginName="Pianoteq 8", programMsg, noteDuration=8, legato=1, amp=0.75, action|
var totalDur = noteDuration * 128 * 2;
var patScore;
var notes = (0..127).collect{|midinote| [midinote, Rest()]}.flatten;
score = Score.new;
// Search for plugins
score.add([0.0, VSTPlugin.searchMsg(verbose: false)]);
// Create synth
score.add([0.0, vstSynth.newMsg]);
// Open VSTi
score.add([0.0, vst.openMsg(pluginName, editor: true)]);
// Choose program
programMsg.notNil.if({
score.add([0.0, vst.programMsg(programMsg)]);
});
patScore = Pbind(
\type, \vst_midi,
\vst, vst,
\midicmd, \noteOn,
\chan, 0,
// Render all notes
\midinote, Pseq(notes, 1),
\dur, noteDuration,
\amp, amp,
\legato, legato,
).asScore(totalDur,0, (vst: vst));
patScore = patScore.score[1..patScore.score.size-2];
score.score = score.score.addAll(patScore); // we have to remove the first and last bundle (/g_new + /c_set)!
score.sort;
score.recordNRT(
outputFilePath: path.standardizePath,
sampleRate: server.options.sampleRate,
action: action ? {"Done rendering".postln},
headerFormat: "WAV"
);
// Clean up
server.remove;
}
}