Making a VSTi Host - Part 1
Updated: Apr 28, 2021
I've recently got hooked on the Output Arcade plugin, which is basically a sampler with tons of different "kits" that include samples that can create a song in a given style, right through to symphonic orchestra ensembles.
The plugin loads up in my DAW and requires the usual midi notes to be entered to trigger the samples. Here's a screenshot showing many instances of Arcade working in Reason 10.
As you may notice many of notes entered are 1 or 2 bars and I started to wonder if I could create my own VSTi Host and enter bar numbers in a grid to trigger Arcade. I'm sure there must be an easy way to do that and given that I've been messing around with code for many years - I thought I'd give it go..
If you enter c# vst host in Google you soon find that there is no easy answer!
Top of the list is Jan Bert who has complete an amazing project and recommended vst.net with NAudio. So I downloaded the libraries and opened up the sample code and failed to understand what was going on! Surely there's a more simple solution?
After wasting hours / days going down rabbit holes into the Steinbergs SDK, Cabbage Audio and Juce I started to think the task was impossible. Both Cabbage and Juce crash when you try to load arcade and Steinberg has a great vst host app but no source code for it.
btw Cabbage Audio is great for making a vst.
Then I stumbled across BASS_VST which actually has a simple getting started page with code that looks like this:
// create a VST instrument stream -- the returned handle can be used with // all BASS_Channel*() and all BASS_VST_*() functions DWORD ch = BASS_VST_ChannelCreate(44100, 2, "c:\\instr.dll", 0); // the returned handle can be used like any other BASS channel handle - // eg. you can add a VST effect and start the stream BASS_VST_ChannelSetDSP(ch, "c:\\equalizer.dll", 0, 0); BASS_ChannelPlay(ch); // ... wait for finish ... trigger notes using BASS_VST_ProcessEvent() ... // when done, delete the VST instrument stream BASS_VST_ChannelFree(ch);
Whoop I thought and opened up Visual Studio 2019 and (after many hours) managed the following:
Load up Arcade VSTi
Play it through an in app keyboard
Enter numbers in a grid for note duration
Convert the numbers to midi notes
Trigger the samples based on the notes
Add sliders for macros and master volume
Then I ran into a big problem - bass vst in c# only handles single events and not a stream of midi notes. I got on the forum and Ian at Un4Seen came through and said "use BASSMIDI to load/parse the MIDI file and then feed the events to the VSTi stream" - unfortunately that needed C++ - oh joy...
So my next step is to start over in C++
Go on to Part 2...