Skip to content

Instantly share code, notes, and snippets.

@aleksas
Last active May 13, 2022 19:59
Show Gist options
  • Save aleksas/3909c5dc7fe04328bfe5f42bde0e3947 to your computer and use it in GitHub Desktop.
Save aleksas/3909c5dc7fe04328bfe5f42bde0e3947 to your computer and use it in GitHub Desktop.
Raspberry 3B+ | HiFi Berry DAC+ Pro | FluidSynth | MIDI keyboard

DRAFT guide for DIY synth: Alesis V61 + Rapberry 3B+ + HiFi Berry DAC+ Pro

Probably 99% compatible with most synths

Setup fluidsynth

sudo apt-get update -y
sudo apt-get install -y fluidsynth

Create or edit a fluidsynth config file and save it to /etc/default/fluidsynth.

Run fluidsynth as a daemon

sudo cp /usr/lib/systemd/user/fluidsynth.service /etc/systemd/system

Compare your /etc/systemd/system/fluidsynth.service with provided fluidsynth.service

Enable and start service

sudo systemctl enable fluidsynth
sudo systemctl start fluidsynth

Setup HiFi berry

Configuration files

Create asound.conf and save this file to /etc/asound.conf:

Modify /boot/config.txt according to HiFi Berry instructions

REFERENCES

pcm.!default {
type hw card 0
}
ctl.!default {
type hw card 0
}
# Enable audio (loads snd_bcm2835)
#dtparam=audio=on
# Enable HiFi Berry DAC + Pro
dtoverlay=hifiberry-dacplus
# Disable EEPROM from loading during startup
force_eeprom_read=0
# Mandatory parameters (uncomment and edit)
SOUND_FONT=/usr/share/sounds/sf2/FluidR3_GM.sf2
# Additional optional parameters (may be useful, see 'man fluidsynth' for further info)
OTHER_OPTS='-C0 -R0 -r48000 -o audio.periods=8 -o audio.realtime-prio=80 -o synth.cpu-cores=4 -o midi.alsa.device=hw:1,0,0 --audio-driver=alsa --midi-driver=alsa_raw --gain=3 --chorus=no --audio-bufsize=64'
[Unit]
Description=FluidSynth Daemon
Documentation=man:fluidsynth(1)
After=sound.target
[Service]
EnvironmentFile=/etc/default/fluidsynth
EnvironmentFile=-%h/.config/fluidsynth
ExecStart=/usr/bin/fluidsynth -is $OTHER_OPTS $SOUND_FONT
#ExecStartPost=/bin/bash -c 'while true; do aconnect -o | grep "FLUID Synth" >> /dev/null && break; done; aconnect 20:0 128:0'
Restart=always
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment