Set up a digital audio workstation

Build a powerful digital audio workstation setup for MIDI composition with Reaper, Raspberry Pi OS 64-bit, and a dedicated mt32-pi external synth

K.G. Orphanides K.G. now has enough GM/GS MIDI devices to create an entire dungeon synth orchestra. @KGOrphanides

This month, we’re using our mt32-pi MIDI synth from issue #114 (magpi.cc/114) to make music. We’ll use a Raspberry Pi 4 8GB model with Raspberry Pi OS 64-bit as our main computer, running our digital audio workstation (DAW) software, and connect our mt32-pi to it using two sets of USB MIDI adapters, as discussed in the previous tutorial. We built our mt32-pi with a 4GB Raspberry Pi 4 and a HiFiBerry DAC+ACD audio HAT, but any mt32-pi build will do the trick, as will an off-the-shelf external synth like the Roland MT-32 and SC-55 we used in issue 111 (magpi.cc/111).

Connect your audio hardware

Connect the usual monitor, keyboard, and mouse to a Raspberry Pi that you’ll be using as your DAW computer. Plug a USB MIDI adapter into any of its USB ports. If you have one, connect a USB MIDI keyboard. Next, connect mt32-pi’s audio outputs (preferably on a dedicated audio HAT) to your speakers, and plug in a USB MIDI adapter. Connect the MIDI IN cable from each adapter to the MIDI OUT cable of the other, and vice versa. Remember that some USB MIDI adapters, such as the industry-standard Roland UM-ONE mk2, label their MIDI IN as ‘Connect to MIDI OUT’ and their MIDI OUT as ‘Connect to MIDI IN’. Connect power to both Raspberry Pi computers.

Download and extract Reaper

Reaper is outstanding, professional-grade digital audio workstation software. It’s free to try for 60 days, but a single-user, multi-device licence costs $60 and is well worth getting if you find the software useful. Go to reaper.fm, click Download, and select the appropriate version for your OS – that should be Linux aarch64 if you’re using Raspberry Pi OS 64-bit, and Linux armv7l if you’re using a 32-bit version. Create a folder in your home directory called Software, copy the downloaded file to it, and extract it via the right-click menu.

Install dependencies

Although you can run or install Reaper straight away, we’re going to install some dependencies and optional components first. Open a Terminal and type:

Most of these will probably already be installed, but JACK in particular is an important optional component, particularly if you want to handle PCM audio in real time, as well as MIDI. We’ll use the a2jmidid package to automatically bridge ALSA’s MIDI sequencer ports to JACK.

We’re going to press I to install it, then 1 to put it in /opt/REAPER, Y to install desktop integrations, Y to create relevant symlinks, and Y again to proceed.

Install Reaper

Open a Terminal, cd to the folder you copied Reaper to and run its installer. For our 64-bit build, that looks like:

Reaper’s installer gives you a few different options. Type R to try it out without installing it. Type I to install it in either opt or ~opt – you’ll probably be prompted for your root password during this process if you choose the former. Or type A to add desktop integrations and file associations for the Reaper executable in its current path.

Configure JACK

Type qjackctl at the Terminal to load GUI controls for the JACK low-latency audio. Press Start on QjackCtl, then open a fresh Terminal and type a2jmidid -e. In QjackCtl, click Graph to see your MIDI and PCM audio connections. Disconnect everything by pressing CTRL+C and then clicking Disconnect in the toolbar. Test your keyboard and mt32-pi by dragging a connection from your keyboard’s a2j capture interface – ‘Vortex Wireless 2 [32] (capture)’ in our screenshots – to mt32-pi’s

a2j playback interface, which will be something like our ‘USB MIDI Interface [28] (playback)’. Make sure your speakers are on and play a few notes. Select everything again and disconnect.

Configure Reaper

Start Reaper from Raspberry Pi’s Sound & Video menu. When you start Reaper, you’ll be informed that it isn’t free software and that you should register it after 60 days. Close this by clicking Still Evaluating, and continue. Go to Options > Preferences and select MIDI Devices under Audio. All your a2j (ALSA to JACK) MIDI ports should be here. Double-click on the entry for your MIDI instrument under the top inputs section and click ‘Enable input from this device’. Click OK. In the outputs section below, double-click the entry for your USB MIDI interface and tick ‘Enable output to this device’. Click OK. You can also enable input or output from the right-click menu of each device. Click Apply and OK.

Prepare a MIDI track

Right-click in the blank area at the left-hand side of the screen and select Insert new track. You can also press CTRL+T to do this. Click the round red record button on the track you’ve just created to arm it, then left-click where it now says ‘Input 1: not connected’. Mouse across your a2j MIDI keyboard entry and select ‘All channels’. Now when you press a key, a yellow level meter should flicker on the channel. We’re now at the point where we can record some MIDI, but we still need to hear what we’re playing. In the mixer panel at the bottom of the screen, you’ll see a mixer to go with our track. Click the stripy Route button and under MIDI Hardware Output, select the a2j USB MIDI Interface entry.

Make sure the playhead (the position indicator on the timeline) is at the beginning. Press the red record button on the main control panel above the mixers and play something on your MIDI instrument. This should default to a general MIDI piano sound, which you should hear in real time as you play. Click the red button again to stop when you’ve finished, and click Save All when asked which files you want to save. Note that this doesn’t save your entire project – press CTRL+S to do that. Now press play – right next to the record button – to listen to your work. Press stop when it gets to the end, and return the playhead to the beginning.

Make sure the playhead (the position indicator on the timeline) is at the beginning. Press the red record button on the main control panel above the mixers and play something on your MIDI.

Having established that everything works, it would make life a lot easier if all our audio daemons launched together. Open QjackCtl’s Setup menu and go to Options. Tick ‘Execute script after Startup’ and add the following to its text entry box:

And in the same way, add the following command to ‘Execute script after Shutdown’:

As a fully-fledged DAW, Reaper can also record analogue instruments as real-time PCM audio, but you’ll need a USB audio interface such as a Focusrite Scarlett to connect microphones, guitars or other instruments to Raspberry Pi, as it lacks any audio input and its integrated BCM2835 analogue audio output isn’t production-quality, either. If you want to export a project with both MIDI and PCM tracks, you can use the FluidSynth SoundFont synthesizer (**fluidsynth.org**) to render MIDI tracks into PCM or use an external mixing desk to route all audio to a recording device. Raspberry Pi isn’t hugely powerful, which limits simultaneous multi-track recording, but it is absolutely silent, making it a useful studio device.

Raspberry Pi 4, particularly the 8GB version running a 64-bit OS, packs in a lot of power for its size and price. However, audio processing can be resource-intensive. While we could get the same sounds by running FluidSynth or a FluidSynth-based VST on our DAW system and routing everything through that, you’re making Raspberry Pi do more work than it has to. Using mt32-pi – or any vintage or modern external MIDI synth – takes some of the load off. This comes in particularly handy if you’re recording PCM audio alongside MIDI.