Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support running status #340

@m-vo

Description

@m-vo

Currently, the Tokenizer just drops data bytes if there was no status byte set in the current message:

mido/mido/tokenizer.py

Lines 56 to 65 in b884bc3

def _feed_data_byte(self, byte):
if self._status:
self._bytes.append(byte)
if len(self._bytes) == self._len:
# Complete message.
self._messages.append(self._bytes)
self._status = 0
else:
# Ignore stray data byte.
pass

The MIDI spec, however, allows to omit status bytes (see MIDI running status) in which case the last transmitted status should be used. In my case a hardware device uses this feature and by this totally scrambles the parser state. 😢

If I see this correctly, the only change needed would be to store the last status byte when completing a message with at least one data byte and only ignore 'stray data bytes' if nothing was set yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions