[alsa-devel] ALSA MIDI interface - plugin

Aldrin Martoq amartoq at dcc.uchile.cl
Mon Feb 18 18:58:56 CET 2008

On Mon, 2008-02-18 at 20:17 +0530, Pharaoh . wrote:
> On Feb 15, 2008 10:23 PM, Takashi Iwai <tiwai at suse.de> wrote:
> > At Thu, 14 Feb 2008 20:54:28 +0530,
> > Pharaoh . wrote:
> > > Now, I have to support rawmidi interface also. Is it possible to write a
> > > userspace
> > > plugin for making MIDI work? Where can I get sample code etc?
> > Another possibility is to write an ALSA sequencer client, and load
> > snd-virmidi driver.  Then you can connect to a rawmidi device as you
> > like.
> Thanks Takashi, I am not sure I understood this fully..Can you point me to
> some sample
> code or relevant documentation.

Look the code of aseqdump from alsa-utils project. You don't need
anything related to kernel, just a normal client that creates a port and
listens for events. Once you receive a MIDI event, process it and do the
magic in your card.

$ aseqdump 
Waiting for data at port 129:0. Press Ctrl+C to end.
Source_ Event_________________ Ch _Data__

$ aconnect -iol

$ aplaymidi -p 129:0 /usr/share/denemo/manual/4for2new.midi

Please note that with the alsaseq API you receive processed MIDI data...
This could be a plus for your development (you don't have to implement
the low-level midi parser). Timidity is a software synth that follow
this approach.

About snd-virmidi, is almost the same, but the port is a 'kernel port'
and it represents a virtual card. I'm not sure what advantages has it.

Aldrin Martoq <amartoq at dcc.uchile.cl>

More information about the Alsa-devel mailing list