[alsa-devel] How to send non-SysEx system messages via ALSA?

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Wed Mar 13 14:36:48 CET 2013

Gabriel Beddingfield wrote:

>>>Inspecting the source, it looks like the kernel seq driver drops the
>>>non-standard 'Tick' message (0xF9).  The only way I know to send it is
>>>to use the rawmidi API.  [Anybody: please correct me if I'm wrong here.]
>>> Since Wine is sending/receiving midi data (without timing) that is to
>>> be sent/received _immediately_ -- you might find life easier by using
>>> the rawmidi api.

Indeed, that sounded like a perfect match.

>> But this would work only with rawmidi devices; hardware synthesizers
>> (OPL3/4/Emu10k1) and any software applications would be excluded
>> (without contortions like snd-virmidi).

OTOH, that sounds like a killer argument against rawmidi.

>Correct me if I'm wrong, but his options are:
>  1. Drop support for any non-standard midi byte streams
>      (e.g. "Tick") by using the seq API, or
>  2. Drop the ability to have a virtual midi device by using the rawmidi API.
>The choice is up to him.

Wine's CoreAudio MIDI driver for MacOS already drives two different API,
one called CoreMidi and another one for the built-in SW-synth. So WineALSA
could do something similar.

However, my current knowledge does not allow me to infer when to open rawmidi
and when the seq interface.  Likewise, Wine presents
all MIDI interfaces as MIDI_PORT to applications and barely knows a difference
between things like Timidity / FluidSynth and HW serial ports.

How would I distinguish and decide which API to use?

Heck, I even find it funny that Timidity and FluidSynth declare different capabilities bits.

Presumably most people use MIDI in Wine to allow
music from games to play.  At least, that's my case, so I toyed with
Timidity and FluidSynth.

However, there are some pro Wine users with real MIDI hardware.
These guys found bugs in Wine in the past, such as
the 2-byte MTC not being generated or getting through, or a KORG
editor SW hanging after sending a strange SysEx F0 ... F7 00 00 00
(terminated by three NUL bytes!).  That's why I want to handle those
cases well too, not just the SW-synth case.  Thus I'd like to be able
to generate and send correct system messages and do something
reasonable with weird data like the above trailing 00 00 00 bytes.

Solved MTC bug in Wine
Open SysEx+00 00 00 bug in Wine

 Jörg Höhle

More information about the Alsa-devel mailing list