JUCE on Raspberry Pi
[raspberry-pi
juce
]
S
o, I wanted to look into how to have a simple development environment for those interested in hardware signal processing boxes. My first inclination was towards using a Raspberry Pi with its GPIO pins and ability to run an OS. It also has some audio cards available as HATs, external ADC boards, USB hardware or even just an IC to make your own. If the Pi was easy to get up and running for this purpose, it would be a pretty nifty tool for teaching DSP. The ADC side of things is one problem, I wanted to see if I could get a development environment working. The first choice was obviously JUCE. Writing code for DSP chips will likely involve C based code, and working with low level language would serve students well when it comes to trying to find work. So, the first step is to actually get JUCE (and Projucer) to run.
Please find below a condensed version of the past week of my life below, which was spent bashing my head against the table and dabbling with things I do not quite understand. There will obviously be some differences between my experience and your own. Please do get in touch if you have any suggestions or helpful hints for others trying to do the same as I have done here.
Setting up JUCE
First off, download the JUCE framework from the JUCE website and move it to your home folder. Your Pi will need an internet connection, and you can connect it to eduroam if necessary. There are a few dependencies that we will need to install before trying to build any projects. It is wise to run sudo apt-get update
before attempting to install any of the following packages. The JUCE dependencies were stolen from the JUCE forums [2]. The install command below is exactly the same as sudo apt-get install clang freeglut3-dev g++ libasound2-dev libcurl4-openssl-dev libfreetype6-dev libjack-jackd2-dev libx11-dev libxcomposite-dev libxcursor-dev libxinerama-dev libxrandr-dev mesa-common-dev webkit2gtk-4.0 ladspa-sdk
the backslash ‘\’ should hopefully make the list easier to read.
After that, make the Projucer app:
Alternatively, you could also use make CXX=clang++ -j4
. You should now be able to start Projucer to create your first JUCE project. Others have had trouble building because of the architecture [1] so it may be worth altering should you have a similar issue.
Development Workflow
For my pi, the build time for a simple JUCE audio application was approximately 30 minutes, your mileage may vary. Raspbian does not have a C++ environments that I find intuitive. You can try code::blocks sudo apt-get install codeblocks codeblocks-contrib
or Geany sudo apt-get install geany
. Personally, the Pi is slow enough just compiling let alone trying to develop on it as well. I find it easier just to code in Xcode and simply push my projects to a git repository that can then be pulled onto the Pi for compilation.
My Build Workflow
When developing a project I take the following approach, which is similar to that suggested by echomesh [2].
- Create project on Projucer
- Develop project in Xcode
git commit
git push
to project repositorygit pull
repository on Pimake
build on Pi
Check out the git tutorial by typing git help tutorial
in terminal for more help with git or check out the online GitHub guide. You could also just copy files directly to your pi if it is in your network with scp with scp -r pi@PI_IP_ADDRESS:/path/to/folder /path/to/target/folder
.
Installing MATE
If you like, you could do all that has been covered on Ubuntu MATE. Note: MATE will not work on a Raspberry pi 3 B+ at time of writing. When installing MATE it is recommend that you use ddrescue
instead of vanilla dd
[4]. In terminal brew install ddrescue
(make sure you have homebrew installed first). Then simply call sudo ddrescue -v --force $IMAGE_PATH $DISK_PATH
in terminal, where $IMAGE_PATH
is the path to the MATE image. If the image is in .xz
compressed format then simply brew install xz
and xz -d file-to-extract.xz
.