Why does Zynthian use mod-ttymidi instead of a kernel-based driver?

I’m new to RPi midi and I was looking at the serial-based midi I/O and noticed it pipes the serial port data through a userland c script into Alsa.

Is there not a proper driver for serial midi? That just seems surprising to me considering how old midi is. I also see old projects like these that seem to address this but they no longer compile for me.

tl;dr why is everyone (Zynthian, blokas, umbrellas) using mod-ttymidi ?

Hi @radioflash ! Welcome to zynthianland! I hope you find fun and good answers!

We use jack for audio and midi, so this driver is not very helpful for zynthian. The mod-ttymidi daemon is a gateway from jack-midi to serial tty. It runs as a real time jack client and use the kernel serial tty driver. Good enough!

Anyway, using kernel stuff is not always the best way. Indeed the jack daemon, that process all audio and midi data flow is a user space daemon.

Regarding the mod-ttymidi itself, there are some limitations in the implementation, but not because of not being a kernel driver.

Best Regards


thanks for the welcome! I’m having fun just looking thru the code.
I did find an updated fork of a serialmidi alsa module that does load and shows up in alsa midi. I cannot test it as I am travelling but it looks promising. I just would like to see a cleaner solution than the mod-ttymidi solution if it’s possible.

for anyone who is interested:

If it’s not in the mainline or raspberry pi os kernel I don’t think it is to get much traction. Maintaining out of tree modules is a pain for sbc communities and is the main reason this community only really supports pi boards.

1 Like

agreed, modules are a high barrier to linux beginners. But the installation of this module is trivial and the rpi OS is not so securely locked down that it makes out of tree modules difficult; just look at the Makefile, its only a few steps.

and perhaps it could make it to the RPI OS eventually! then adding midi to a Pi would be easy and we could take advantage of all those pl011 uarts that otherwise are useless

Bear in mind also that a kernel driver that interfaces to provide an alsa device must subsequently be converted to a jack client. Our current solution does that directly, avoiding the alsa stage. Recent changes to alsa have caused us lots of problems due to name truncation. tty-midi is suboptimal but it works for our purpose.


ah thank you for that explanation. That helps me understand the issue more :+1: