I try to use raspberry together with USB MIDI keyboard and qsynth.

I use the following script at autostart that starts qsynth and connects MIDI keyboard to qsynth.

qsynth -a=alsa &
sleep 5
aconnect 20:0 128:0
echo "Done"

The autostart procedure is taken from [http://www.raspberrypi-spy.co.uk/2014/05/how-to-autostart-apps-in-rasbian-lxde-desktop]

It doesn't work. Manual run of the script works correctly. After reboot when I connect with VNC I see that qsynth is working but connection to MIDI keyboard is not established.

Is seems like there is a problem with USB initialization at the startup, may be I use wrong order of startup.

  • The USB subsystem in general will be up and available by the time userspace applications start.
    – goldilocks
    Jan 7, 2015 at 16:50

1 Answer 1


During startup, many other programs are being run, so it's likely that qsynth takes longer than five seconds to start.

Wait until aconnect succeeds:

qsynth -a=alsa &
while ! aconnect 20:0 128:0; do sleep 1; done
echo Done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.