Tutorial: Create a basic Audio/MIDI plugin Part 1: Setting up

This tutorial will help you to set up your computer and create an Projucer project for developing Audio Plug-Ins (VST and AudioUnits) using JUCE.

At the end, we will end up with an actual audio-plugin that says "Hello, World!" and can be loaded into VST hosts like Cubase or Ableton Live.

Level: Intermediate

Platforms: Windows, Mac OS X, Linux

Classes:

Getting started

Download JUCE. Unpack the JUCE folder and place it to some location on your computer. Your user home folder is a convenient place.

Launch the Projucer application, which is located in your JUCE folder.

If you are not familiar with the Projucer yet, please read Tutorial: Getting started with the Projucer first.

Download and install plug-in dependencies

VST3

Download the VST3 SDK from the Steinberg SDK download portal. This will allow you to build both VST2 and VST3 plug-ins.

Once you have downloaded the VST SDK you need to perform a one-time set-up in the Projucer in order for it to find all of the relevant files. Open the Projucer and navigate to menu item Tools > Global Preferences... Make sure that the Paths tab is selected. Add the SDK paths to the relevant fields.

Note
If you remove the text from the field for a particular path first, you can then drag-and-drop the directory from your operating system.
tutorial_create_projucer_basic_plugin_0.png
Adding your VST SDK path

If you have the VST 3 SDK you can add the same path top both the VST SDK and VST3 SDK fields. If the paths are correct they should be displayed in black text (or red if there is a problem).

AudioUnit (Mac OS X only)

Setting up for building Audio Unit plug-ins is even easier since all of the files that you need are packaged with JUCE. (As long as you are using a recent version of JUCE.) There's no need to add any paths to the Projucer as everything is built-in.

Create an audio plug-in project with the Projucer

To create an audio plug-in with JUCE, create a new project in the Projucer and select Audio Plug-In as the project type. See Tutorial: Getting started with the Projucer if you don't know how to do that.

In the Projucer’s configuration settings for the new project, you can change project settings, such as which plug-in types you wish to export and whether the plug-in receives or produces MIDI notes (amongst many other things). You can change these settings at any time.

In this tutorial we are creating a VST plug-in, so make sure that Build VST is ticked. Then scroll down the settings window and tick Plug-in wants midi input and Plug-in produces midi output.

That’s all the config you need! Now click Save Project and Open in IDE... Your new project will open. Click the build button to verify that your plug-in builds and that everything has been set up correctly.

Set up plug-in debugging (optional)

One of the challenges of building plug-ins is testing them. Thankfully, JUCE makes that easy, with a built-in plug-in host. To access the host go to examples/audio plugin host/ and open the .jucer file with the Projucer. Click Save Project and Open in IDE.... Then inside your IDE build the project to create a binary (which on Mac OS X you will find at examples/audio plugin host/Builds/MacOSX/build). Copy that binary to somewhere accessible, as you will often use it.

Run the application and you will see the graphical node editor that looks like this:

tutorial_create_projucer_basic_plugin_1.png
The JUCE plug-in host

Pressing "Cmd-P" (or going to Options > Edit the list of available plug-ins...) will allow you to update the list of plug-ins on your system (you will only have to do this once per project). Click the options button at the bottom of the pop-up window and click Scan for new or updated VST plug-ins.... JUCE Audio plugins are automatically copied to ~/Library/Audio/Plug-Ins/VST, and the host application automatically searches that folder, so you shouldn’t need to manually specify where to look — just click Scan.

Once the scan is complete go back to the node editor and right click, then select your plug-in from the context menu (it will be under a company called "yourcompany" by default - you can edit this in the Projucer). Connect the nodes up such that the MIDI input and Audio Input nodes are routed to the inputs of your plug-in, and that your plug-in’s audio output are routed to the Audio Output node.

tutorial_create_projucer_basic_plugin_2.png
Making connections in the JUCE plug-in host

Double click your plugin to launch the GUI. The default plugin does nothing but show Hello world.

You can select Options > Change the audio device settings... to make sure your inputs and outputs all go to the right places. Hit File > Save to make it easy to retrieve this configuration.

Used in this way the Plug-In Host gives you a very simple environment in which to test a plug-in, but there’s more that we can do. We can configure the host to enable step-through debugging of your plugin. To do this, go back to your plug-in project in Xcode, click Product > Scheme > Edit Scheme..., then under Run select Other... from the Executable dropdown and locate the Plugin Host.app binary. Make sure Debug executable is ticked.

Now when you build and run your plugin within Xcode it will automatically launch the host, and when your plug-in is loaded inside the host you can set breakpoints and do step-through debugging.

Next steps

Now you are ready and good to go to code an audio plug-in that actually does some audio. Read on in Tutorial: Create a basic Audio/MIDI plugin Part 2: Coding your plug-in.

Notes

To build AAX plug-ins (for Pro Tools) you will need to contact Avid for a developer license in order to access their SDK. If you do obtain access to the AAX SDK you will notice that the Projucer has a path that you can set in its Global Preferences window.

Summary

After reading this tutorial, you should be able to:

  • Install the necessary dependencies for audio plug-in development,
  • Create an Projucer project for a JUCE audio plug-in,
  • Set up a debugging environment for audio plug-in development.

See also