Subject: Re: MIDI renovations available for testing
To: None <M.Drochner@fz-juelich.de>
From: Chapman Flack <nblists@anastigmatix.net>
List: tech-kern
Date: 05/22/2006 13:13:56
Matthias Drochner wrote:
> Do your changes affect synthesizers on soundcards?
> As eg midi2 in
> 
> sb0 at isa0 port 0x220-0x237 irq 5 drq 1: dsp v3.02
> audio1 at sb0: half duplex, mmap, independent
> midi1 at sb0: SB MIDI UART
> opl0 at sb0: model OPL3
> midi2 at opl0: SB Yamaha OPL3

So far, only slightly: midisyn (the glue layer above opl0, invisible
in dmesg, that allows midi2 to attach) used to contain a slightly
incomplete MIDI parser that could conceivably get lost in certain
streams of valid running status or System Exclusive messages, though
I don't know if anyone has ever experienced such a problem. That
code is now gone because midi(4) feeds fully canonicalized messages
to midisyn.

However, as noted in BUGS for man midi, midisyn is most rudimentary
at this point. It understands a tiny few of the standard MIDI controllers,
and its voice-stealing algorithm does not seem very sophisticated; that
is especially noticeable on devices with more limited polyphony, such
that you wind up hearing almost randomly sampled notes from among
the sounding voices. :(

I have begun working on a standard MIDI controllers module (nothing
committed yet). As for the voice stealing, I am not an expert on such
algorithms so I am sort of hoping that somebody else will be one, or
want to become one. :)  I know some of the more obvious ideas are
"recycle the voice whose currently sounding note is softest, or has
decayed the most since its attack" and it might be good to protect
any voice playing in legato mode from recycling. Other heuristics
might be to avoid stealing voices with the brightest/most perceptible
timbres, which could perhaps be estimated from the data fed to the
synth chip. But here I am well out of my depth, and I'm pretty sure
that even simple refinements to the current voice stealing would
give a noticeable improvement in practice.

-Chap