ALSA input from MIDI keyboard

334 Views Asked by At

I'm writing a software synth in Linux using libasound. I want to control it with a MIDI keyboard.

I have some working code using snd_seq_open() and snd_seq_event_input() but it only creates a virtual MIDI port. I have to go to the commandline and type "aconnect 20 128" to route the MIDI data to my app.

How can I get my code to either set up the connection by itself or connect directly to the MIDI hardware?

1

There are 1 best solutions below

0
CL. On BEST ANSWER

You have to create the connection with a function like snd_seq_connect_from().

See, for example, the aseqdump source code.