Skip to content

Empty note array to piano roll leads to ValueError on empty sequence. #356

@lmartak

Description

@lmartak

For an empty MIDI file pred_MIDI (e.g. transcription gone real bad):

import partitura as pt
PERF_PIANO_ROLL_PARAMS = {"time_unit": "sec", "time_div": 100, "onset_only": False, "piano_range": True, "time_margin": 0, "return_idxs": False}

pred_perf = pt.load_performance_midi(pred_MIDI)
pred_na = pred_perf.note_array()
pred_pr = pt.utils.compute_pianoroll(pred_na, **PERF_PIANO_ROLL_PARAMS)

fails on the following line:

min_time = 0 if min(onset) >= 0 else min(onset)

with ValueError: min() arg is an empty sequence.

Probably just cosmetics of exception handling, just thought I'd report (close if irrelevant).

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