I’m trying to write C functions which talk directly to Pisound’s MIDI ports. I know that it’s possible to use the command line utility amidi to do this (e.g. amidi -p hw:1,0 -S 91 3c 7f to send a noteon message that plays middle C at max velocity on channel 2) but (correct me if I’m wrong) to do that in a function would need a system call (system(“amidi -p hw:1,0 -S 91 3c 7f”)), and it doesn’t seem to be possible to pass values as arguments this way. I’m very inexperienced writing C code, so apologies if this is a naive question. What I’m looking for is something along the lines of this, which achieves what I’m after but in Arduino:
Thank you. Had a look at aseqsend.c and it made me realise that I’ve probably bitten off more than I can chew - a bit advanced for me so will come back to this once I’ve got some more coding experience under my belt. But thank you again.
Using ALSA sequencer API is the most direct way You could look into using some C/C++ libraries such as PortMidi (couldn’t find a succinct example, but the API is mostly here) or rtmidi (example)
ALSA RAW MIDI might work as well, but it works in a sort of exclusive way, you could choose to use it only for MIDI output, ALSA Seq API is more preferred by Linux audio software, as it can be freely routed around between audio applications and hardware.