Realtime digital audio processing using VST Plugins in programs without VST support

Notice! Please note that the software in this guide is closed source donationware/freeware.

An instructional how-to guide

Please scroll down a bit for the guide to configure and set it all up.

Why?

If you have sensitive hearing like me and enjoy listening to high fidelity music with high dynamic range its pretty annoying when the source quality of a track is poorly mastered. Usually it’s compressed to sound louder so it overshadows background noise when listening with open headphones, on the radio or on television. This compression phenomenon when referring to music media is commonly referred to as the loudness war.

Now, this post isn’t going to be about the loudness war but IT IS the main reason why I run some digital signal processing (DSP) using VST plugins. Basically a desperate attempt to save my poor ears from fatigue after long listening.

The Plugins?

VST Plugins use an open framework initially developed by Steinberg makers of Steinberg Cubase. The interface was released openly and is used by many different kinds of software in the digital audio processing field.

You might want to run VST plugins that simulate equalizers, reverb, pitch, chorus, expanders or any other kind of audio filter for that matter. In order to run these plugins in general software usually you need some kind of Wrapper.

Wrappers?

Wrappers are “plugins for the plugins”. Although there are only a few media players that have them.

For the music player Foobar2000 I’ve been using a VST wrapper for my needs. As you may know Foobar2000 is designed to only play audio. How do we run our VST plugins when watching video as well as audio?

The solution to signal processing using (almost) ANY program on Windows is to simulate a virtual soundcard device.

Sound card device (virtual cable) simulation

Properly referred to as “virtual cable simulation” is when you create a passthrough virtual sound card between the software playing the audio, the software processing the audio and the device playing back the audio.

Here is a workflow chart describing the process

workflow

Unfortunately there is no completely open source solution for simulating a sound device as far as I know. If you find one please leave a comment!

There is a very good free “donationware” closed source driver named VB-Audio Virtual Cable. This will be the software refered to in this guide/tutorial.

When VB-Audio Virtual Cable is installed and you’ve rebooted your computer you should notice two new audio devices named CABLE Input and CABLE Output in your windows audio settings. The left image shows the playback tab and the right image the recording tab.

sounddevices sounddevices_rec

Audio signal processing software VST Host

VSTHost is a free program that used to be open source. It’s currently closed due to the author disliking it being included without attribution. It’s still very much free to use and great for running your collection of VST plugins.

It can be a very complex program to use at first but hopefully I will manage to describe it easily for the purpose of running one simple example VST plugin.

Here is an image of VSTHost running a single simple VST plugin called ReLife V1.42 (C) by Terry West.

vsthost1

This plugin applies a phase shift, equalizer and a declipping algorithm to improve dynamics in overcompressed music. Of course if the audio source file is horribly overcompressed don’t expect it to perform miracles. Still it’s a great band aid to make listening to modern music easier on the ears.

Step by step setup instructions

Here is how you put it all together.

1. Download VB-Audio Virtual Cable Driver

The version I’ve installed and tested doesn’t contain any adware or malware and according to my firewall doesn’t attempt to connect to the internet for any reason. It’s named the following:

Virtual Audio MME, DX, WDM Device Driver (XP, VISTA, WIN7, WIN8 32/64 bits).
VBCABLEDriver_Pack42b.zip (1.01 MB – JUL 2013).

MD5 VBCABLEDriver_Pack42b.zip: 09b90461ea6f3d15f52bfff1a00e6690

2. Unpack the zip archive

Choose a folder that you wish to keep the control panel application. For example C:\Program Files\VBCable\

3. Run the setup corresponding to your operating system.

I.e. VBCABLE_Setup_x64.exe if youre running 64 bit. If you aren’t sure which you’re running check this guide.
After installing make sure to reboot.

4. Check the sample rate for VB-Audio Virtual Cable Driver

Start up the control panel by starting VBCABLE_ControlPanel.exe and note the output sample rate. In this case 44100 Hz.

The VB-Audio control panel looks something like this:
vbaudiosamplerate

Note!  If you’re only using the VST plugin for listening to music you don’t need to worry about anything other than the output sample rate. For video and audio “lip sync” check the bottom of this article.

5. Download VSTHost

I’m using version 1.54 and have tested it safe from adware and malware.
Choose vsthostx86.zip or vsthostx64.zip depending on your OS.
MD5 vsthostx86.zip: 7eb6fd861c976ea393875e85981a67ac
MD5 vsthostx64.zip: f51441c48c73bbd2dfd202ea7c51bcb1

6. Unpack the zip archive in the folder you wish to run it from.

For example C:\Program Files\VSTHost\

7. Get copies of the VST Plugin DLL files that you wish to use.

For example put all plugin DLL files in C:\Program Files\VSTHost\Plugins\
If you already have the VST Plugin files that you intend to use you can skip the next step.

8. Example VST plugin – Terry Wests ReLife utility V1.42.

If you don’t have any VST Plugins I will be using this as an example.
MD5 relife142.zip: 0d431c5dc7ac207e387835752a2fc380
EDIT: After I wrote this guide Terry has removed the download link for ReLife. It now costs money to download (still confusingly called donationware). As such this is a bad VST example and I apologize for that. You can find other free VST plugins here or here.

9. Run vsthost.exe and Click on Devices -> Wave to set your devices.

vsthost-device1

Here you want to set Input port to:
DS: CABLE Output (VB-Audio Virtual Cable) which we installed previously

Output port can be set to your playback device of choice. If you choose:
MME: Microsoft Sound Mapper
This means it will playback on your default Windows DirectSound output device which is probably what you wish to do.

10. [EDIT: Added this 2014-10-11] – Change process priorities to high

Depending on your sound card performance you should increase the process priority to high to avoid accidental random jitter.
Go into Engine -> Configuration and set the following:

engine

11. Choose the correct sample rate and buffer size for your needs

Make sure to select the same sample rate as in VB-Audio control panel in step 4. In this case set the sample rate to 44100 Hz

For the buffer choose  2100 samples (21 b/s) for now. This value is beneficial to be as low as possible with regards to audio delay but if it’s too low you will hear noise interruptions caused by the computer keeping up to such a small buffer. If you hear clicking noise increase this.

Note! Same note as in step 4, if you’re only using the VST plugin for listening to music you don’t need to worry about anything more. For audio and video “lip sync”, see the bottom of this article.

12. Drag and drop the plugin DLL files that you wish to use on the vsthost window

In this example just drag and drop ReLife.dll

13. Arrange the plugins in the order you want them to work in a workflow sheet.

Here you can link together several VST plugins in the order that you want. Feel free to play around and make this as simple (or complex) as you wish!
Here are examples of a more complex setup.

14. Configure ReLife

Click on the small meter icon to show the VST interface

vsticon

After clicking on ReLife you should see this. I prefer to use peak algorithm number 3.

relife

15. Save your settings!

When you are done it should look something like this:

vsthost1

Click on Performance -> Save to save your current configuration.

Left click on each plugin to select it. Then right click it and make sure that the following is checked. This will ensure that VSTHost remembers settings for each VST plugin:

  • PlugIn -> Autosave bank
  • PlugIn -> Reload bank
16. Set default playback device in the program

Locate the option in your playback program to change output device (also called audio renderer) to specifically use “Cable Input”.

Here are examples of how to change it in VLC:

Changing it from this menu is only temporary:

vlc audio device

You want to change it here for VLC to remember the settings:

vlcdevice

And Media Player Classic:

mpc audio device

Some programs don’t support changing the default output device. Unfortunately you won’t be able to use this solution with those.

17. Startup automatically with windows

If VSTHost isn’t running you won’t hear any audio so you may want it to start automatically with windows. Here is how:

    • Click on View -> Minimize to system tray in VSTHost, check it.
    • Create a shortcut to VSTHost.exe and place it in your Start Menu – > Startup folder
    • Right click the shortcut and select Properties
    • Change “Run Normally” to “Minimized

Microsoft also have some instructions.

18. Complete!

You are complete, the remaining steps are optional and only required if you intend to playback both video and audio together.

19. [Optional] Minimizing latency and “lip syncing”

The more latency you have for processing audio, the more delayed it will be when also watching video. To correct the delay between audio and video you need to manually specify the amount of delay for the video. This is also called “lip syncing” referring to the voices not moving accordingly to lips of people in video.

To calculate the “lip syncing” we need to get the size of the buffers created by VSTHost and VB-Audio. Unfortunately the delay must be calculated since buffer is sized in “samples” and not in time “seconds”.

To translate samples into seconds we need to divide the buffer sample size with the total sample rate.
Millisecond delay * Sample rate = Buffer sample size

When we know the delay in milliseconds for both VB-Audio and VSTHost we can add them together to get the total audio delay. This is the value we enter into the video player like VLC.

VSTHost latency

The buffer and sample rate is visible in Devices – > Wave where we previously set input/output devices.

vsthost-device

To calculate the delay in time (seconds)
Example: 2100 / 44100 = 0.0476… seconds

VB-Audio latency

The buffer and sample rate is visible in the VB-audio Control panel.

vbaudiosamplerate

To calculate the delay in time (seconds)
Example: 7168 / 44100=0.1625… seconds

Total latency

This gives us a total latency of 0.0476… + 0.1625… =  0,2101 seconds
Which is 210 milliseconds total.

20. [Optional] Configuring VLC audio delay to fix lip syncing

Go into Tools -> Preferences and select to Show All settings. Then Select Audio in the left tree menu and set Audio desynchronization compensation to -210 milliseconds

vlc-delay

Known Issues (2014-04-28)

The audio delay may sometimes be delayed more than it should. I’ve noticed this a couple of times. Restarting VSTHost or changing the buffer rate temporarily and then back appears to fix it. I’ve done a lot of testing but am unsure of what’s actually causing it. If you have any ideas be sure to leave a message.

Thanks!

I hope this instructional guide was helpful to you 🙂

If you have any questions, anything more to add or if I made a mistake please don’t hesitate to leave a comment!