Building my Zynthain for usb midi


Hi Zynthians,
2 weeks ago I finally decided to make a Zynthan box.
I had to learn a lot, encountered problems, unexpected things, solved some, got things working, and still have a way to go. I would like to share my experiences with the community, hoping that it will help other new(er)bies.
This will be an expanding story, growing with my experiences in the coming weeks.

My immediate purposes for the Zynthain are:
a) a stand-alone companion to my piano lessons, playing click track, bass, drums, solo lines, initially in short pieces but longer or complete when I know the song better, with adjustable speed to match my skill at the time. Normally i will enter these (simple) lines in a score editor (museScore), as part of the lessons.
The setup will be: a midi sequencer in the z-box, sound generated by the external midi synth/piano, and several usb-midi devices: a controller on the desktop, a footcontroller for hands-off play controls, and one of 3 passible midi keyboards/piano
b) giving my old yamaha organ (serial midi) a Hammond-like sound using setBfree, to be controlled partly by the organ, and by a usb-midi controller.

As a desktop computer, I have a linux Kubuntu 17.10 (low-latency) desktop computer, that use for music-related activities, connected via wired LAN to the Synthain box.
I started with a standard RapsberryPi-3 with 7" touch screen and a hifiBerry+ audio output card, bought separately.
It took some time to get all the hardware connected correctly, getting information from several sources on the internet. I ende up using 2 usb power plugs, one (1A) for the display, the other (2.5A). This way, I didn’t have to zsolder anything on this standard rPi.

Download, and writing the Zynthain image on my 32MB SD-cart was easy, following the instructions. As wat the initial startup in the Zynthan box.
the got ssh remote terminal connection working, the webcontrol page (using Firefox), remote file access using FileZilla.
Now it was time to get some sound out of it.

That took some time, getting used to commandline operations jack, alsa, midi device names, the way Zynthian UI handles USB midi. I had not hardware (yet) for serial midi.

hint: a system diagram how the (usb)midi and other devices are interrelated, might be handy

problem: Zynthan will not connect to usb-midi devices when powered up
After power-up with usb-midi devices already connected (or externally powered devices already switched on) and, they are listed as alsa devices (amidi -l, or qjackctl) but not under a2j in the jack midi devices; connecting using aconnect fails with “device temprarily unavailabe” (qjackctl will fail silently).
After remove and re-insert, or power down/up, the usb-midi device, Zynthian will handle the device as expected.

problem: the Alsa midi-port number that is part of the jack (a2j) device name, can be different between subequen power-on’s.
When you have multiple usb device and no all are connected of powere ond, the ala port numer in the device can change.
My midi configuration reads:
ENABLED_OUT=ttymidi:MIDI_out,a2j:DigitalKBD [20] (playback): DigitalKBD MIDI 1
where “20” changes with the onder in which multiple usb device are connected.
For midi rules this seems not to be problematic, unless you can specify a device name in a rule.
But it is in the midi configuration for disabling midi output devices and fatal when enabling an input device
And I don’t know a way to fix this when using it stand-alone, unless you have another computer at hand to access the webconfig page.

question: qJackctl log window shows evey 2 seconds a message "JACK connection graph changed"
Is that normal?

[next time more]