Copyright © 2005-2023 MultiMedia Soft

How to manage VST effects

Previous pageReturn to chapter overviewNext page

Steinberg's Virtual Studio Technology (VST) is an interface for integrating software audio synthesizer and effect plugins with audio editors and hard-disk recording systems. VST and similar technologies use Digital Signal Processing (DSP) to simulate traditional recording studio hardware with software. Thousands of plugins exist and VST is supported by a large number of audio applications. The technology can be licensed from its creator, Steinberg.

 

Audio Dj Studio API for .NET allows managing two kinds of VST plugins up to the VST 2.4 implementation:

 

VST effects: this kind of plugins allows processing the audio input, for example for creating a reverb effect, and/or performing analysis of the audio input, for example for creating custom visual feedbacks.
VST Instruments: this kind of plugins allows generating audio without the need to load it from a sound file: they are generally either virtual synthesizers or samplers

 

Both kinds of VST plugins are available inside external dynamic-link library (DLL) files.

 

The first step for integrating a VST plugin is to load it into the control through the VST.EffectLoad method (for VST effects) or through the VST.InstrumentLoad method (for VST instruments).  Both mentioned methods receive the filename or the absolute pathname of the external DLL file containing the VST plugin and returns a 32 bits unique identifier that identifies the loaded VST plugin from now on: from a programming perspective, calling this method is quite similar to calling the LoadLibrary Windows API.

 

Once we have successfully loaded the VST plugin and obtained its unique identifier, we can gain access to other VST-related features.

 

Generic information about the VST plugin can be obtained through the VST.GetInfo and VST.GetInfoString methods.
Discriminate if a VST plugin is an effect or an instrument through the VST.GetType method.
Available programs implemented inside the VST plugin can be enumerated through the VST.ProgramsGetCount method and respective programs names can be obtained/modified through the VST.ProgramNameGet and VST.ProgramNameSet methods.
The current program can be obtained through the VST.ProgramGetCurrent method and selected through the VST.ProgramSetCurrent method.
For each program there is the possibility to enumerate the number of available parameters through the VST.ProgramParamsGetCount method and to obtain generic information for each of them through the VST.ProgramParamGetInfo method.
Each parameter has a default value that can be obtained calling the VST.ProgramParamGetDefaultValue method. The current value can be obtained through the VST.ProgramParamGetValue method and modified through the VST.ProgramParamSetValue method.
Most VST effects come with their own user interface, also known as "editor": you can know if a loaded VST effect has its own editor through the VST.EditorGetInfo method.
If an editor is available, you can integrate it and show/hide it on your application's user interface through the VST.EditorShow method and move it through the VST.EditorMove method.

 

When a parameter has been modified through the editor, the container application is notified through the CallbackForPlayersEvents delegate which is invoked with the nEvent parameter set to EV_VST_PARAM_CHANGED.

When the editor's user interface is resized, the container application is notified through the CallbackForPlayersEvents delegate which is invoked with the nEvent parameter set to EV_VST_EDITOR_RESIZED.

 

During playback VST effects can be enabled/disabled through the VST.EffectEnable method: through this method you can not only create a chain of VST effects but, through its nPriority parameter, you can establish which VST effect will be processed first.

 

 

IMPORTANT NOTICE ABOUT EFFECTS APPLIED TO THE OUTPUT OF A STREAM MIXER BEING SENT TO A CASTING SERVER OR TO THE RECORDER

 

VST effects can be applied to the output of a custom stream mixer by using the unique identifier of the custom stream mixer itself for the nPlayer parameter of the effect to apply; if you want that these effects are reflected to the stream going to the casting server or to the recorder control also, you need to set the nPriority parameter of the VST to a value higher than 0.

 

 

Differently from VST effects, which process the audio generated by a player taking audio from an external source like an audio file, VST instruments cannot be chained because they are audio source themselves so each of them needs a separate player. You can mix more VST instruments into a single audio stream by creating a custom stream mixer and attaching each separate VST instrument to the mixer.

 

For VST instruments there is the possibility to apply MIDI events through the VST.InstrumentEventApply method or raw MIDI events through the VST.InstrumentEventRawApply method.

 

Once the VST plugin is no more needed, it can be discarded from memory using the VST.EffectFree method (for VST effects) or through the VST.InstrumentFree method (for VST instruments).

 

A sample of use of the VST object in Visual C# and Visual Basic.NET can be found inside the following samples installed with the product's setup package:

- VstEffects

- VstEffectsWasapi