Re: [linux-audio-dev] MIDI bank select MSB + LSB

From: Alexandre Ratchov <alex@email-addr-hidden>
Date: Sat Dec 09 2006 - 21:21:20 EET

On Sat, Dec 09, 2006 at 05:04:16PM +0100, Christian Schoenebeck wrote:
> Am Samstag, 9. Dezember 2006 03:01 schrieb Alexandre Ratchov:
> > Keyboards that only support "MSB only" mode (or "LSB only" mode)
> > are just too limited and there is no workaround that will "just
> > work" with both modes. AFAIK, there is no standard way to detect if
> > a device will use MSB, LSB or both. According to midi standard the
> > bank number is (LSB + 128 * MSB), so the "Both" mode is the correct
> > one to use. That's also what most users would expect.
>
> Of course there is no real way to detect if a keyboard sends MSB-only or
> LSB-only bank selects, but there would be a workaround at least. I guess I
> will implement it similar as suggested by Grigor and Rui:
>
> "Normally, the instrument is only changed effectively when, and only when, a
> program change is received? Check. So, let's try having two int placeholders
> per MIDI channel for bank selection in linuxsampler, one as MSB and another
> as LSB, initialized to -1. If a bank MSB arrives, it will override the
> corresponding variable. Same as LSB, but independently. Then, if the LSB
> variable has the -1 value then, most probably, the sending device does not
> support the conjugated bank selection method, and in that case the MSB value
> will function as LSB alone, but iif the stored LSB value is -1, meaning that
> it was untuoched by the sending device. Once the program change is done, just
> reset both values to -1 and we're back in business ;)"
>
> At least I can't see a drawback of this workaround.
>

hmm... MIDI spec says that if only MSB (or LSB) is received, then
the last value of LSB (or MSB) will be used. If the default bank is
0 then if bank MSB (or LSB) has never been received 0 will be used
as "last value".

AFAIK a device that uses both LSB and MSB is allowed to transmit
the following messages:

bank_msb 1 # set bank to 128
prog_change 2 # load patch 2 from bank 128

or the following:

bank_msb 10 # set bank to 1280
bank_lsb 1 # set bank to 1281
prog_change 2 # load prog 2 from bank 1281
bank_msb 0 # set bank to 1
prog_change 3 # load prog 3 from bank 1

This is unlikely to happen with a MIDI keyboard in real-life,
however a MIDI sequencer that keeps state of already transmitted
messages may transmit messages like the above.

cheers,

-- Alexandre
Received on Tue Dec 12 00:15:13 2006

This archive was generated by hypermail 2.1.8 : Tue Dec 12 2006 - 00:15:13 EET