def piano_roll(annotation, sr=<NUM_LIT>, length=None, **kwargs):
intervals, pitches = annotation.to_interval_values()<EOL>pitch_map = {f: idx for idx, f in enumerate(np.unique(pitches))}<EOL>gram = np.zeros((len(pitch_map), len(intervals)))<EOL>for col, f in enumerate(pitches):<EOL><INDENT>gram[pitch_map[f], col] = <NUM_LIT:1><EOL><DEDENT>return filter_kwargs(mir_eval.sonify.time_frequency,<EOL>gram, pitches, intervals,<EOL>sr, length=length, **kwargs)<EOL>
Sonify a piano-roll

    This uses mir_eval.sonify.time_frequency, and is appropriate
    for sparse transcription data, e.g., annotations in the `note_midi`
    namespace.