class_docstr: Encodes list/array format piece into pianorolls and decodes into midi.
docstr: Decodes pianoroll into midi.
docstr_tok: ["Decodes","pianoroll","into","midi","."]
code: def decode_to_midi(self, pianoroll):
      """Decodes pianoroll into midi."""
      # NOTE: Assumes four separate instruments ordered from high to low.
      midi_data = pretty_midi.PrettyMIDI()
      duration = self.qpm / 60 * self.shortest_duration
      tt, pp, ii = pianoroll.shape
      for i in range(ii):
          notes = []
          for p in range(pp):
              for t in range(tt):
                  if pianoroll[t, p, i]:
                      notes.append(
                          pretty_midi.Note(
                              velocity=100,
                              pitch=self.min_pitch + p,
                              start=t * duration,
                              end=(t + 1) * duration,
                          )
                      )
          notes = merge_held(notes)
  
          instrument = pretty_midi.Instrument(
              program=self.programs[i] - 1
          )
          instrument.notes.extend(notes)
          midi_data.instruments.append(instrument)
      return midi_data
  
file_path: magenta/magenta/models/coconet/lib_pianoroll.py
imports: import numpy
  import pretty_midi
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling the PianorollEncoderDecoder obj's underlying member method code with example usage: obj.decode_to_midi(pianoroll) and returns: midi_data