Skip to content

Getting the TRACK_NAME for each track in a MIDI file #9

@cameronprince

Description

@cameronprince

Hello,

Thanks for a great project. I've been able to parse a MIDI file and play it on a MIDI output feeding to a keyboard from a Pico.

I was curious if there is a better way to get the track names. This is what I have gotten to work, but it's pretty slow:

    file_path = init.SD_MOUNT_POINT + "/" + self.file_list[self.selected_file]
    midi = umidiparser.MidiFile(file_path, buffer_size=0)
    for event in midi:
        if event.status == umidiparser.TRACK_NAME:
            self.track_list.append(event.name)

I tried several ways to get it from midi.tracks, but haven't been successful.

Please let me know and thanks again,
Cameron

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions