IoT 11: How to Use VST Plugins in LMMS with Carla on ARM Linux
Last Updated on January 28, 2022
First Published on January 23, 2022
VST plugins online are almost for Intel processors. Therefore, we need to build VST plugins for ARM processors. I'm not a computer music enthusiast, but I need to describe this messy street with my hope for further development of the scene of computer music. This is the next edition of "IoT 10: How to Use VST Plugins in LMMS on Linux".
Raspberry Pi OS can install LMMS from apt package manager. Amazingly, Raspberry Pi has ARM that the LMMS community recognizes it doesn't fit with LMMS. In fact, LMMS works well on Raspberry Pi. Probably, the distributor of Raspberry Pi OS has dedicated to build LMMS for ARM. I found out a YouTube video to build LMMS for Raspberry Pi OS, and I made a patch to help building on ARM in my private fork of LMMS. The advantage of computer music on Raspberry Pi is optional digital analogue converters (DACs). You would use your small computer as the gadget of computer music, even on your competitive stage performance like stock car racing.
* In the stage scene, a laptop computer would help to display Raspberry Pi OS and control your online live, and it even becomes a backup.
LMMS works fine on ARM thanks to Linux, but VST plugins online wouldn't work because they include machine code for Intel processors. Please distinguish issues between the matter of operating systems and the matter of processors. If you install Wine (a layer to execute Windows programs in Linux) to your ARM Linux, Wine is dedicated for programs of ARM Windows. If you want to Wine dedicated for programs of Intel Windows on ARM Linux, you need an Intel emulator. We can find out Intel emulators such as Box86.
I'd like to introduce usage of VST plugins in LMMS with Carla on ARM Linux. All programs needs to be built to become ARM natives. This means I use neither Wine nor Box86. Note that Carla aren't in the package list of Raspberry Pi OS, and you can request packaged Carla to Raspberry Pi community.
1. Raspberry Pi 3B (I don't have Raspberry Pi 4B, and may buy it)
2. Raspberry Pi OS (32-bit) Based on Debian Version 11 Bullseye Released on 2021-10-30 (Recommended Version on Raspberry Pi Imager v1.6.2)
-i. Turn off Bluetooth to get memory space to build programs.
-ii. Disable "Screen Blanking" at the "Display" menu of Raspberry Pi Configuration not to bite memory on this process.
-iii. On building a program, ensure to close any browser that needs much memory. Use the command line interface (CLI) if you meet a freezing OS. Therefore, I recommend that you try these with Raspberry Pi 4B (4GB/8GB) or 400.
-iv. Ensure to set an appropriate audio output, e.g., AV Jack or HDMI. Confirm status by right clicking the volume icon at the upper right corner in default configuration.
3. Genuine SD Card Such as 32GB One
I describe the process schedule. Ensure the order of build and installation because of dependencies. Particularly, build Carla before LMMS.
1. Build and Install Carla:
git clone https://github.com/falkTX/Carla.git
# Install dependencies for Debian-based systems described in its INSTALL.md (except libqt4-dev).
# Check whether all dependencies are met in your system.
sudo make install PREFIX=/usr/local
# Execute Carla to check.
2. Build LMMS from My Fork:
git clone --recursive --branch develop-1.2 https://github.com/JimmyKenMerchant/lmms.git lmms_fork
# Install dependencies for Ubuntu described in https://github.com/LMMS/lmms/wiki/Compiling
# Install wine-stable and libwine-dev on this point if you need these.
cmake ../ -DCMAKE_INSTALL_PREFIX=../target/ -DWANT_QT5=ON -DARCH_IS_ARM32V8=ON
# Execute LMMS to check. Carla (Carla Patchbay and Carla Rack) should be appeared in the list of plugins.
sudo cp -r ../target/* /usr/local
# Confirm that LMMS can be executed by name.
# Remove files except files in "lmms" folders.
# lib/libqx11embedcontainer.a will also be removed. Check dependencies with other applications.
find ../target -print | sed "s#../target#/usr/local#" | sed "\#/usr/local/[^/]\+/lmms/#d" > list.txt
# Remove non-recursively.
sudo xargs -L 1 -t rm < list.txt
# Remove files in "lmms" folders
sudo rm -r /usr/local/*/lmms
I prefer to install Wine (wine-stable and libwine-dev) before building LMMS for DLL files of ARM Windows (*-multilib doesn't exist because of 32-bit system). However, it needs a Linux kernel (/boot/kernel7.img) rebuilt from 2G/2G virtual address split to 3G/1G split. Raspberry Pi 4B seems to fit with Wine without a rebuilt Linux kernel because of having 3G/1G split on its kernel image (/boot/kernel7l.img).
3. Build ADLPlug, A VSTi Plugin:
git clone --recursive https://github.com/jpcima/ADLplug
# For __atomic_* functions that g++ (GNU C/C++ compiler for arm-none-linux-gnueabi) needs explicit assignation as "-latomic".
# LLVM Clang is preferred for portability of projects, e.g., on ARM processors.
sudo apt update
sudo apt install clang
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
cmake --build .
# Ensure valid plugin paths in the "Settings" menu of Carla (from "Configure Carla").
mkdir -p $HOME/Documents/carla/plugin/vst2 && cp ./vst2/ADLplug.so $_
sudo mkdir -p /usr/local/lib/lxvst && sudo cp ./vst2/ADLplug.so $_
# LADSPA Version 2 Plugin
sudo mkdir -p /usr/local/lib/lv2/ADLplug.lv2 && sudo cp -r ./lv2/ADLplug.lv2/. $_
Caution that VST2 plugins don't appear on the "Add New" menu appeared by clicking "Add Plugin" of Carla, but searches the path listed in the "Settings" menu if the plugin doesn't exist on its original path. Check "Found it! :)" in the "Logs" tab.
* I don't recommend "make -j4" or "cmake --build . -- -j4" with Raspberry Pi 3B because of exhausting memory and freezing.
I gathered all dependencies and edited the list of packages to build Carla, LMMS, and ADLplug.
sudo apt update
sudo apt install build-essential cmake git perl \
python3-pyqt5.qtsvg python3-rdflib pyqt5-dev-tools \
libx11-dev libx11-xcb-dev libxcb-keysyms1-dev libxcb-util0-dev \
libgtk2.0-dev libgtk-3-dev \
libfltk1.3-dev libxinerama-dev libxft-dev libxml2-utils \
libxml-perl liblist-moreutils-perl \
qtbase5-dev qtbase5-private-dev qttools5-dev qttools5-dev-tools libqt5x11extras5-dev \
liblo-dev libasound2-dev libpulse-dev \
libsndfile1-dev libfftw3-dev \
libvorbis-dev libogg-dev libmp3lame-dev libjack-jackd2-dev \
libsamplerate0-dev libsdl-dev stk libstk0-dev portaudio19-dev \
libgig-dev libfluidsynth-dev \
lv2-dev liblilv-dev \
Wine may be needed in case of using DLL files. You need to implement Box86 or any i386 emulator to run DLL files for 32-bit Intel Windows.
sudo apt update
sudo apt install wine-stable libwine-dev
4. Just Run:
"Carla Patchbay" is the exact plugin to use Carla in LMMS. Caution that you need to drag and drop a plugin to Rack in its GUI, and make connections in Patchbay. For example, connect "Capture 1" of "Midi Input" to "events-in" of "ADLplug", and connect "output_1" of "ADLplug" to "Left" of "Audio Output". "Midi Input" means notes on Piano Roll in this case.
Note that in the terminal, "undefined symbol: __atomic_fetch_xor_8 - /usr/local/lib/lxvst/ADLplug.so" appears if you compile with ARM g++ (GNU C/C++ compiler for arm-none-linux-gnueabi) that doesn't link libatomic (According to my OS image, /usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0 is implemented on 01/21/2021 when Raspberry Pi Pico was introduced publicly) implicitly. I guess this issue has been coming from ARM's history for embedded systems. You can also watch warnings including famous one from libEGL on your terminal, and observe the stability of this musical system.
I think the reliable way to play musical system on Raspberry Pi with its official OS is what you prefer to use LADSPA and LV2 plugins rather than VST plugins. As long as an open source VST plugin is with JUCE, a LV2 plugin seems to be built. In my next challenge, I would try to build a LV2 plugin from an open source VST plugin.