Posted on

How to Make Hello, World with JUCE 5

If you’re interested in audio programming – specifically plugin or application development – JUCE is a C++ library you’re definitely going to want to know.

JUCE not only has an extensive code library, but also comes with a tool called the “Projucer” that rapidly builds a code framework depending on what you’re looking to create.

The Projucer
The Projucer will build you a code framework for a bunch of different use cases

In this post I’m going to walk you through making a “Hello, World!” audio plugin with JUCE, the Projucer, Windows and Visual Studio 2017 Community. Remember, as silly and/or boring as it sounds, “Hello, World!” is one of the most useful programs you can create. It makes sure your system and all the software you’re using are working correctly, and can write code with no other concerns!

If you’re still interested in exploring JUCE more after reading this post, you can find additional information and tutorials on the JUCE website.

Prerequisites

To complete this tutorial you should have a basic working knowledge of C++.  By that, I mean it will be considerably easier to do this tutorial once you understand syntax, includes, etc. You can find a free video tutorial over at Cave of Programming.

  • Download Visual Studio 2017
  • Download JUCE (Currently at 5.1.1)
  • Download VST3 SDK

Installation Steps

Visual Studio

To install Visual Studio Community Edition – simply download the program and install it as you would any other Windows application.

JUCE

The Windows download of JUCE currently comes as a .zip file. There is no executable. I “install” Juce to C:\JUCE in order to find it quickly and easily.

VST3 SDK

As with JUCE, there is no “installer” for the Steinberg VST3 SDK. Instead, I have a folder where I place all development libraries on my drive. I would encourage you to do the same, something like C:\Development Libraries. Copy the VST SDK (all of it) there.

 

Getting Started

Once you’ve done all that, start up the Projucer. The first thing you’ll notice is the wide variety of audio application types the Projucer provides frameworks for. Super nice, right?

But before we plow headfirst into JUCE, we need to setup our VST3 library. Even if you don’t build to VST3, this step will teach you how to include external SDKs in JUCE (such as for AAX plugins).

Go to File > Global Search Paths and you’ll see a window like below:

Global Search Paths
Your global search paths should look something like this

Add the path to your VST3 directory as shown. If the path is accepted by the Projucer, it’ll show up in white text. You’ll know something is wrong with a path in JUCE if it shows up in red text – that’s super important and has occurred to me multiple times.

Once this is done, you can go ahead and create an audio plugin project.

In the project settings you’ll want to make sure “Build VST” is enabled.  You can also enable “Plugin Midi Input” and “Plugin Midi Output” to give yourself a quick example of how that works.  Be sure to name and provide a “company” for your plugin too!

From there, jump into the edit window and make sure your VST3 SDK path is showing up in white. If it’s in red, you need to copy the correct path to your VST3 SDK folder and put it here.

Once all of this is done, make sure to hit File > Save. Then you can jump in your IDE (Visual Studio) to make sure everything got setup right!

Building

If you get any errors once you jump in Visual Studio, you’ll need to go back to the Projucer and see if you missed any steps.

If everything looks ok, switch your build target to “Release” and then go ahead and run Build > Build Solution. Visual Studio should start chugging away.

If you haven’t run into errors yet, this is where you might.  Initially I found compiler errors because my VST3 SDK location wasn’t in the correct place within the Projucer. Double check all your paths and make sure nothing is red!

Once the program builds, you make have additional “warnings” depending on your settings. For now, you can likely ignore these.

Now it’s time to test your plugin!

Testing

There’s two ways you can test your new plugin – go ahead and throw it in your favorite DAW, or build the JUCE plugin host.

I know you probably want to run to your DAW, and you should! But, since you’re going to need a test environment, I’m also going to show you how to get started with the JUCE Plugin Host.

The JUCE Plugin Host is essentially a sandbox where you can test out the functionality of your plugin without having run it directly in a DAW or by building a standalone version.  It’s super useful to utilize to make sure everything is working the way that you planned for it to.

First, navigate to the directory where you extracted JUCE (remember mine was C:\JUCE), then jump in the examples\audio plugin host folder and open Plugin Host.jucer.

Once you have the .jucer file open, you can jump directly into Visual Studio.  Once again, change your build target to “Release” and then build the Plugin Host with Build > Build Solution.

Keep in mind, if you see any errors, check your paths in the Projucer. Alternatively, you can of course hunt down the errors yourself!

Once the Plugin Host is built, you can go ahead and run it. Initially you’ll see a very blank screen:

The Plugin Host
The Plugin Host starts out very empty

To fix this and play with your “Hello, World!” plugin, you need to go copy your plugin to the C:\Program Files\VstPlugins directory. Or, put it where the rest of your VST plugins are located.

From there, within the Plugin Host, you need to go to Options > Edit the list of available plug-ins… and scan for VST plugins. If you’ve saved them in a different directory, you need to add that directory.

Go ahead and connect all the nodes up as shown below:

Plugin Host node graph
Look at those beautifully connected nodes!

Once you do this, if you have an operating microphone on your computer, you’ll be able to hear any input from your system’s microphone so long as your speakers aren’t muted!

To get our coveted “Hello, World!” Double click your plugin within the Plugin Host. You should see this:

Hello World!
If you made this, you succeeded!

Congratulations, you’ve built your first audio plugin with JUCE! You should also be able to confirm that it actually passes audio! Pretty super cool, right?

I’ll be coming back to JUCE more often with examples you can work on. For now, if you have any trouble getting this working ping me @adamtcroft.


Copyright 2016-2021, NIR LLC, all rights reserved.