0

I'm trying to set up a little soundfont player for my usb MIDI keyboard with my Raspberry Pi 3B+ (Raspbian Lite 4.18). I'm using Fluidsynth for that.

At startup this script is ran via cronjob:

#!/bin/bash
echo "Starting"
/usr/bin/fluidsynth -is -a alsa --gain 3 /usr/share/sounds/sf2/FluidR3_GM.sf2 &

echo "Fluidsynth started"
while true; do if [[ $(/usr/bin/aconnect -o ) = *FLUID* ]]; then break; fi; sleep 2; done

/usr/bin/aconnect 20 128
echo "Connected"

And Fluidsynth doesn't make a noise until I kill the process manually and I start it again. Then everything works.

Happens the same when I start it manually. First time, nothing; but second time works perfectly. I tried to run it from the first time with other users, and plugging/unplugging the connection between the keyboard and the synth.

Any ideas? Thank you.

  • Are you using PulseAudio, or does Fluidsynth play directly to the ALSA device? – CL. Mar 18 '19 at 08:35
  • Directly to ALSA, sorry for the late response. – Miguel Moles Mar 20 '19 at 12:39
  • Does the same happen when you run `aplay something.wav` (two times)? – CL. Mar 20 '19 at 14:13
  • Aplay does work perfectly, it's not ALSA's problem. Anyway now I just launch Fluidsyth via JACK and it seems it's working now. Thanks for the help – Miguel Moles Mar 20 '19 at 18:21
  • While I have no clue how to answer your question, the script is really nice and helped me a lot. I changed the logic, though. I started with your IF, and only start fluidsynth if `aconnect -o` sees no FLUID. You really want to make sure that you don't end up with TWO fluidsynth processes. Perhaps that was your problem. For convenience I also added `echo Waiting 2 seconds` in the loop, for convenience to the user – Roland Jul 13 '21 at 15:43

0 Answers0