[alsa-devel] Range of pitchbend MIDI events

Clemens Ladisch clemens at ladisch.de
Tue Aug 30 10:15:41 CEST 2016


Maurizio Berti wrote:
> 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

The ALSA sequencer does not use the MIDI byte format for its events.

Sequencer events use a 32-bit field for controller values:
http://www.alsa-project.org/alsa-doc/alsa-lib/structsnd__seq__ev__ctrl__t.html
and the entire structure is delivered unchanged to the receiving
sequencer client.

Events get converted into actual MIDI bytes only when they end up at
a real MIDI port.  In that case, only the lowest 14 bits of the value
are put into the two data bytes of the pitchbend event.


Regards,
Clemens


More information about the Alsa-devel mailing list