2

I have an unused midi keyboard collecting dust in my closed, and was thinking to connect on it a RPI 3B with a small LCD screen, to use it as standalone synth.

Currently I am running a 2 GB setup, which is headless, because I don't really do anything that require a GUI; although for music software, I realized that there are no console based applications, for that purpose. Found some mp3 players that run completely from terminal, without the need of using X server or a WM; but no app that can be comparable to a modern synth.

The final product would look like one of those fancy keyboards with LCD screen; but with the difference that I can play it without the need to have a computer attached to it; and do everything on the Pi, using the touch screen.

Tried to find a specific distro for musicians and had no luck; the few out there are tailored for X86_64. Same for the software; which seems usable only on a big screen, while I have a small LCD, and as such, I need to run the simplest UI possible.

Does anyone have any experience with some or all of those topics? I can use a standard PI distro but considering the power on the board; I would like to run as lean as humanly possible; after all most of the synths you buy, do not run on quad core CPU, so I am trying to get the best of both worlds.

rataplan
  • 196
  • 1
  • 12

1 Answers1

1

NOTE: To this point, I am unable to get the Pi 3 B+ built-in audio connector to work with Ubuntu MATE 18.04. The solution below was tested using an inexpensive ($12) external USB-DAC for the audio connector.

Yes, you can run a synth without having a GUI. There's something to be said for running without a desktop window manager. There will be a lot fewer processes competing for resources (CPU,RAM,Audio), and this increases the effective horsepower of your Raspberry Pi.

I did this with Ubuntu MATE 18.04 ARMv8/64 after killing the GUI:

sudo service lightdm stop

You can also use raspi-config to disable the GUI from starting on boot.

Of course all of this would also work from a terminal with the Desktop still running.


With no GUI, you may have to manage PulseAudio sinks with pacmd set-default-sink (name). With any luck, the shell will provide tab completion to help you with the name.


Install the components:

sudo apt install fluidsynth fluid-soundfont-gm alsa-utils
sudo apt remove jackd ## 'jackd' can complicate sound configuration

Launch the synthesizer:

fluidsynth -a alsa /usr/share/sounds/sf2/FluidR3_GM.sf2 -o synth.gain=0.5 -o audio.periods=8 -o synth.cpu-cores=4

Use another terminal to connect your controller to the synth:

aconnect --list |grep client

aconnect 24 128 ## example ID values for controller and synth

Side note: You can change the instrument at the fluidsynth prompt: prog 0 5, channels


Optional handling for fluidsynth warnings:

fluidsynth: warning: Failed to set thread to high priority
fluidsynth: warning: Failed to pin the sample data to RAM; swapping is possible.

Add something like the following in /etc/security/limits.conf (make sure the user/group name is applicable):

myusername   -  rtprio      unlimited
myusername   -  memlock     unlimited

...and probably reboot to activate (test activation with ulimit -Sa).

Addressing these warnings may improve the consistency of your synthesis quality.

Note: Raspbian already has these higher ulimits by default.


Once you have achieved basic functionality, you may find that you need to make trade-offs between sound clarity and latency by adjusting the sample-rate and buffering used by fluidsynth. But the values provided here seem to work pretty well (with the defaults for other settings) on Pi 3 B+ once I set the unlimited ulimits and run without the GUI.