[LAD] python-alsa-midi – new Python interface to ALSA sequencer

Jacek Konieczny jajcus at jajcus.net
Fri Dec 31 14:18:17 CET 2021


When working on my hobby project, a Raspberr-Pi based wireless foot 
switch for my VOX Adio Air GT guitar amplifier, I hit, once again, the 
same problem: there is not good Python library for use with ALSA MIDI 

Those that can be found on PyPI are either very outdated an 
unmaintained, useless with modern Python 3.x, or they use one of the 
portable MIDI libraries (PortMidi or RtMidi) and lack much of the ALSA 
sequencer API functionality – useless for my use case, where the MIDI 
port may appear and disappear at any time.

Last time, with another project, I wrote my own limited bindings. This 
time I had no urge to code any C any more. I decided to use cffi this 
time and, instead of making limited set of bindings for the one use 
case, to make a proper Python package.

And here it is:


The project should work on any Linux distribution and architecture 
(provided ALSA kernel module and library is available), on Python 3.7 to 
3.10. Asynchronous asyncio API is also provided.

The API is not complete yet – some ALSA sequencer API functions are not 
covered or not fully covered, but I think it is complete-enough for most 
use cases.

I am thinking about adding raw MIDI API too, just for the completeness, 
so the package name is not confusing.

Now it is great time to evaluate the new API, as I would like to make a 
1.0.0 release soon and then I would rather not do any 
backward-incompatible changes.

I hope someone will find this code useful.


More information about the Linux-audio-dev mailing list