[alsa-devel] Range of pitchbend MIDI events

Maurizio Berti maurizio.berti at gmail.com
Tue Aug 23 23:59:02 CEST 2016


Hello,
I was playing with pyalsa and I realized an unexpected behavior with
pitchbend events.
The pitchbend range should be, by MIDI standard, between -8192 and +8191,
or 0-16384. Being a 3 byte event, it should ignore any subsequent byte
received.

Using pyalsa I'm able to create events with values greater than 127 and
they are translated using as many bytes as possible; in fact, if I create a
note event with a note value of 8193, I receive a value 1 (using the first
byte of a 2 byte value with 7bit format).
That's fine, I suppose it's by architecture (I'm not a programmer, I just
play around with python, I'm just assuming this).
The problem comes with pitchbend values, since it looks like alsa accepts
values greater than 8191 and does not ignore the exceeding bytes as it
should; that is, I'm able to send 8192, and that's what vkeybd does.
The transformation here is the issue, since receiving programs seem to
translate only the latest two bytes, that's why vkeybd (and other software
too) shouldn't have a 8192 value.
That can be confusing, for example, using a2jmidi: the end of the pitchbend
scale is suddenly a 0 value; I know that vkeybd is not the ultimate
software in music production, but, still, it shouldn't be able to do so, I
think :)

I don't know if, maybe, there's some less known aspect regarding pitchbend,
and, as I mentioned before, I don't know a thing about programming, nor how
actually works ALSA under the hood. Anyway, I think there should be some
kind of range control, at least with pyalsa, if not by alsa at all.

What do you think?

Regards,
Maurizio

-- 
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net


More information about the Alsa-devel mailing list