Is there an easy way to integrate the Rubber Band TimeStretch library in a JUCE plugin built with CMake?
Unfortunately, it looks like they are using another build system and have configurable external libraries. I would prefer to build always from the source instead of using the compiled library. I want to avoid building it for all platforms and install the required tools on every platform (maybe they are already available in compiled form?).
It hasn’t to be Rubber Band, but it looks like this is the most popular after zplane’s elastique that may also is an option.
I have been been working on a project on the side which integrates Rubberband and had a situation similar to yours. I had just about got to grips with CMake, so didn’t want to start trying to grapple with yet another build system.
I found a CMakeLists file which integrates well with my project. I really wanted to provide details of the author, but honestly I can’t find the source again when trying to Google it, so unfortunately our hero must remain nameless
Honestly, my CMake knowledge is still a bit sketchy, so I can’t help much beyond this - but for me it was as simple as adding this to my Rubberband subdir, and adding the line add_subdirectory(dependencies/rubberband) to my main CMakeLists.
Thanks a lot for the information. I also know not much about CMake. Looks like a lot of code I can’t maintain in a reasonable time
I had contact with one of the people from breakfastquay.com. Looks like they will release an update in a few weeks that makes it possible to include a single C++ file with a standard configuration that compiles out of the box. This would be super great
Fair enough - thats good news that they’re going to go with a single file approach, I will be interested to try that out also.
Looks like a lot of code I can’t maintain in a reasonable time
I understand that maybe it just makes a bit more sense to wait for the simpler single file method, but really this is also quite simple too. I don’t think I had to make any modifications to the CMakeLists file itself to get Rubberband to compile / link correctly.
If you’re already using CMake I would recommend cloning the Rubberband repo into your project & just taking the code I provided as is and saving it in the root directory of Rubberband. Really couldn’t be simpler in terms of CMake integration in my opinion. Granted I’ve only tested it on MacOS but I don’t see why other platforms should cause any more difficulty.
Another possibility you could explore is to install the compiled library somewhere on your machine (e.g. for MacOS brew install rubberband) and use find_library(RUBBERBAND NAMES rubberband) in your main CMake file. This is the simplest way to get started in my opinion, but at the expense of introducing dependencies that others have to install manually
@kunz could you maybe give an example how to integrate the rubberband library with CMake (or Projucer)? Or a hint how to do it, because rubberband doesnt provide a CMakeList build/integration and the rubberband examples dont help me. Thanks in adavance!
I was able to compile a JUCE Projekt + rubberband with your CMake hints! I had to use C++14 to get rubberband running ( C++17 & 20 will cause some std::byte ambiguous symbol errors)
cmake_minimum_required(VERSION 3.15)
project(audioPlugin VERSION 0.0.1)
add_subdirectory(modules/JUCE)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++14")
endif(MSVC)
set(CMAKE_CXX_STANDARD 14)
juce_add_plugin(audioPlugin
COMPANY_NAME "yourcompany" # Specify the name of the plugin's author
PLUGIN_MANUFACTURER_CODE Comp # A four-character manufacturer id with at least one upper-case character
PLUGIN_CODE SPIT # A unique four-character plugin id with exactly one upper-case character
FORMATS VST3 Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3
PRODUCT_NAME "audioPlugin") # The name of the final executable, which can differ from the target name
juce_generate_juce_header(audioPlugin)
target_sources(audioPlugin
PRIVATE
source/PluginEditor.cpp
source/PluginProcessor.cpp
modules/rubberband/single/RubberBandSingle.cpp)
target_compile_definitions(audioPlugin
PUBLIC
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_VST3_CAN_REPLACE_VST2=0
NOMINMAX #you should only use this on windows
)
target_link_libraries(audioPlugin
PRIVATE
juce::juce_core
juce::juce_audio_utils
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)