Guide: How to use Rubberband for pitch shifting in JUCE

I’m making this post because it took me a few hours to figure out how to use the Rubberband pitch-shifter with JUCE and I thought it’d be nice to have a little guide for other beginners.

  1. I’d just download the repo as a zip from Github
    a. You can build it pretty easily by opening \otherbuilds\rubberband-library.vcxproj and building in Visual Studio
    b. Now you should have a rubberband-library.lib file under rubberband-default\otherbuilds\x64\Debug\rubberband-library.lib
  2. You need to link the library and headers in the Projucer
    a. Under the exporters section, press Visual Studio 2022 (or whatever), and under external libraries to link add the path to your rubberband-library.lib
    b. Under Debug/Release there should be a field for the header search paths, here you should link to \rubberband-default\rubberband
    c. Also in case it isn’t clear, you need to include where rubberband-default is located in each path

Now you should be able to #include <RubberBandStretcher.h>

It’s not so easy to work with the library. There’s some official notes here and the documentation is also here. I have a class that I’ll put here when I fix some issues.

2 Likes

Did you choose the Desktop development with C++ workload in Visual Studio Installer?

I have Desktop and .NET but not sure which are actually necessary.

I got syntax error while following your instruction:

What is the code screenshot you shared? And I’m not sure about the Android exporter, maybe there’s some differences to get that working.

1 Like

Hi, @dhng22!
if the problem still persists, in the path use “\” instead of "", it should solve your error.

Just wanted to add to this how I made it work in XCode.

  1. Cloned the rubberband github repo. Installed meson and ninja with brew.
    a. Access it through the terminal and configure the architecture with by running this on the terminal:
CFLAGS="-arch arm64" CXXFLAGS="-arch arm64" meson setup --buildtype=release --prefix=/usr/local --libdir=lib --default-library=both --force-fallback-for=fftw build_directory

b. Create a new folder named build, and access it. Configure the build with:

meson setup --buildtype=release --prefix=/usr/local --libdir=lib --default-library=both --force-fallback-for=fftw ..

c. Run ninja and the build folder is full of stuff.

  1. Created the following project structure (can’t show the actual names because it is company info): Root project folder with the projucer and stuff contains a libs folder. libs structure contains the whole build and the headers in another folder named include as you can see here:

  2. Wired everything up in the projucer like so. In the project settings (gear icon):

This was definitely the trickiest part to figure out. In the XCode exporter:

Huge shoutout to this video that helped me so much, specifically with that last step.

1 Like