[clug] Midi from C (some pygame like api?)

John Mills johnmi at effect.net.au
Tue Jan 22 07:32:54 UTC 2019

On Tue, Jan 22, 2019 at 05:22:58PM +1100, Hal Ashburner via linux wrote:
> I'd like to do just this, again, but from C rather than python for reasons
> that may be misguided but they're mine and I'm going with them. (I'd prefer
> not C++ for this because C is already in use for the project of which this
> is a minor part).
> Anyone got a cluebat? I'm not having much luck with libasound-dev examples
> or tldp (old) documents trying to open an throw bytes at /dev/snd/seq or
> whatever else I'm turning up from search engines and code reading.
> I'm not making music (or even trying to), I just want the absolute minimum
> to get a sound out using midi for some kind of data sonification
> experimental hackery-pokery thing. data in -> transform to midi bytes ->
> noise
> Cheers,
> Hal
JACK Audio Connection Kit will do this.
While it may not be minimal, it's tested and reliable and has a C API.
You write a callback which places MIDI event structures on a queue.
JACK then sends them out to your MIDI interface.
There are packages in at least Ubuntu repos.
My current install:
aptitude search jack|grep ^i
i   libjack-jackd2-0                - JACK Audio Connection Kit (libraries)     
i A libjack-jackd2-0:i386           - JACK Audio Connection Kit (libraries)

QJackCtl provides a graphical patchbay to connect your app to your MIDI interface. 

 - and you would need a softsynth.
Currently I'm happy with AMSynth which even has some FM sounds for DX7 enthusiasts.

John Mills

More information about the linux mailing list