VST.NET 'Hello world"

Aug 10, 2010 at 9:38 PM
Hi all, I am a programmer fascinated from this project, and I catched the opportunity to learn C# using this library. My goal is to create my host to customize the interface of some VST plugin, in this way I'll can create my personal effects panel. My problem is that i can't not able to compile any of the samples that i found, receiving errors anytime. I follow all 'readme' and downloaded many samples but my VS2008 Pro refuse to complete any compilation. Obviously many problems come from my low knowledge of the C# language (and english too), so I ask where I can download some simple sample 'hello world' source including only the the main libraries and classes to create a base to integrate and develop complete application. I hope to be clear Regards Paolo Pini
Aug 11, 2010 at 5:13 AM

If you download the samples .zip from the "Downloads" page, you should be alright. Can you copy-paste some of these errors here, so we (I) can have a look.

Aug 11, 2010 at 11:36 PM
Edited Aug 11, 2010 at 11:36 PM
Make sure you remove missing files references: "AssemblyInfo.General" in every project.
Make sure you remove missing files references: key files (*.snk) in every project.
Make sure you remove key signing in every project configuration.

The samples should compile after following these steps.
Aug 12, 2010 at 12:22 AM
Edited Aug 12, 2010 at 12:23 AM

Many thanks,

I've compiled the samples succesfully!
Now I'm tryng to understand the Host sample to try to hear something from an effect plugin, but for now it's still misterious how pass an audio file to the plugin loaded (if it can).
When I'll understood more I'll come back  here with specifics questions.

Aug 12, 2010 at 2:13 AM
Edited Aug 12, 2010 at 6:15 AM

Vst.Net (and the Vst sdk) does not include classes for audio playback or audio file reading. So while you can pass an audio buffer to the ProcessReplacing function in order to process it with a Vst effect, you will not hear anything. I suggest using NAudio library (also hosted on CodePlex) for the Audio input/output.

To get you started here are the steps I suggest for your requirements:
1. Read an audio file with NAudio, the library will convert it to an Audio buffer.
2. If necessary convert the NAudio buffer format (interlaced bytes) to the Vst.Net audio buffer format (-1 to 1 floats).
3. Process the input buffer from step 2 with Vst.Net (ProcessReplacing).
4. Convert Vst.Net processed audio buffer to the NAudio buffer format, you can avoid this step with NAudio WaveProvider32 Class.
5. Write the output buffer from step 4 to NAudio audio output (write file or audio device output).

You can find code and advices on how to use ProcessReplacing and a Audio output device in this thread:

To convert NAudio wave buffer to Vst.Net buffer you need to know how the buffer is structured.

For example NAudio 16 bit 2 channel audio buffer is structured like this:
WaveBuffer[x] // Channel 1, first byte
WaveBuffer[x + 1] // Channel 1, second byte
WaveBuffer[x + 2] // Channel 2, first byte
WaveBuffer[x + 3] // Channel 2, second byte

Vst.Net 16 bit 2 channel audio buffer is structured like this:
VstBuffer[0][x] // Channel 1, 1 float
VstBuffer[1][x] // Channel 2, 1 float

Note that for 16 bit audio you need to convert two NAudio buffer bytes to a [-1, 1] range float (Vst format), the second byte should be shifted when you convert bytes to float (endianness matters).

The code for conversion should look like this (not tested):

int x=0;
int y=0;

while (y < WaveBuffer.Count)
   VstBuffer[0][x] = ConvertUShortToMinus1to1Float( (ushort)WaveBuffer[y] + ( (ushort)WaveBuffer[y+1] >> 8) );

   VstBuffer[1][x] = ConvertUShortToMinus1to1Float( (ushort)WaveBuffer[y+2] + ( (ushort)WaveBuffer[y+3] >> 8) );
   y += 4;

float ConvertUShortToMinus1to1Float(ushort inParam)
   return inParam * (1f / (ushort.MaxValue / 2f)) - 1f;


Audio programming is much easier than it seems when you strip out the DSP / Math jargon...

Remember that lazy programmers are the best programmers XD

Tell me if you need more info about anything. Happy coding :D

Aug 12, 2010 at 7:31 AM


Many thanks YuryK your reply is very precious!

I began to compose the puzzle.

Let me digest all this code (I'm tryng to learn .NET && VC# && VST.NET,at same time) then I'll back soon.

Only 1 question, you think my project to create a customized visual interface for 3/4 audio and/or midi plugins can be some hope of success?


Aug 12, 2010 at 3:22 PM
Edited Aug 12, 2010 at 3:22 PM
If I understand correctly you want to create a 4 audio mixer with vst plugins?
If so than yes it's definitely possible, Vst exposes it's parameters separately from the Gui.
I created a custom generic Gui for plugins that don't expose a Gui, it's very easy.
For that, take a look at the GetParameter(index) and SetParameter(index) as well as GetParameterName().
Vst exposes parameter names, parameter values and parameter values label (%, ms, db etc..)