class_docstr: MIDI File.
  
  Parameters
  ----------
  filename : str
      MIDI file name.
  file_format : int, optional
      MIDI file format (0, 1, 2).
  ticks_per_beat : int, optional
      Resolution (i.e. ticks per quarter note) of the MIDI file.
  unit : str, optional
      Unit of all MIDI messages, can be one of the following:
  
      - 'ticks', 't': use native MIDI ticks as unit,
      - 'seconds', 's': use seconds as unit,
      - 'beats', 'b' : use beats as unit.
  
  timing : str, optional
      Timing of all MIDI messages, can be one of the following:
  
      - 'absolute', 'abs', 'a': use absolute timing.
      - 'relative', 'rel', 'r': use relative timing, i.e. delta to
        previous message.
  
  Examples
  --------
  Create a MIDI file from an array with notes. The format of the note array
  is: 'onset time', 'pitch', 'duration', 'velocity', 'channel'. The last
  column can be omitted, assuming channel 0.
  
  >>> notes = np.array([[0, 50, 1, 60], [0.5, 62, 0.5, 90]])
  >>> m = MIDIFile.from_notes(notes)
  >>> m  # doctest: +ELLIPSIS
  <madmom.io.midi.MIDIFile object at 0x...>
  
  The notes can be accessed as a numpy array in various formats (default is
  seconds):
  
  >>> m.notes
  array([[ 0. , 50. ,  1. , 60. ,  0. ],
         [ 0.5, 62. ,  0.5, 90. ,  0. ]])
  >>> m.unit ='ticks'
  >>> m.notes
  array([[  0.,  50., 960.,  60.,   0.],
         [480.,  62., 480.,  90.,   0.]])
  >>> m.unit = 'seconds'
  >>> m.notes
  array([[ 0. , 50. ,  1. , 60. ,  0. ],
         [ 0.5, 62. ,  0.5, 90. ,  0. ]])
  >>> m.unit = 'beats'
  >>> m.notes
  array([[ 0., 50.,  2., 60.,  0.],
         [ 1., 62.,  1., 90.,  0.]])
  
  >>> m = MIDIFile.from_notes(notes, tempo=60)
  >>> m.notes
  array([[ 0. , 50. ,  1. , 60. ,  0. ],
         [ 0.5, 62. ,  0.5, 90. ,  0. ]])
  >>> m.unit = 'ticks'
  >>> m.notes
  array([[  0.,  50., 480.,  60.,   0.],
         [240.,  62., 240.,  90.,   0.]])
  >>> m.unit = 'beats'
  >>> m.notes
  array([[ 0. , 50. ,  1. , 60. ,  0. ],
         [ 0.5, 62. ,  0.5, 90. ,  0. ]])
  
  >>> m = MIDIFile.from_notes(notes, time_signature=(2, 2))
  >>> m.notes
  array([[ 0. , 50. ,  1. , 60. ,  0. ],
         [ 0.5, 62. ,  0.5, 90. ,  0. ]])
  >>> m.unit = 'ticks'
  >>> m.notes
  array([[   0.,   50., 1920.,   60.,    0.],
         [ 960.,   62.,  960.,   90.,    0.]])
  >>> m.unit = 'beats'
  >>> m.notes
  array([[ 0., 50.,  2., 60.,  0.],
         [ 1., 62.,  1., 90.,  0.]])
  
  >>> m = MIDIFile.from_notes(notes, tempo=60, time_signature=(2, 2))
  >>> m.notes
  array([[ 0. , 50. ,  1. , 60. ,  0. ],
         [ 0.5, 62. ,  0.5, 90. ,  0. ]])
  >>> m.unit = 'ticks'
  >>> m.notes
  array([[  0.,  50., 960.,  60.,   0.],
         [480.,  62., 480.,  90.,   0.]])
  >>> m.unit = 'beats'
  >>> m.notes
  array([[ 0. , 50. ,  1. , 60. ,  0. ],
         [ 0.5, 62. ,  0.5, 90. ,  0. ]])
  
  >>> m = MIDIFile.from_notes(notes, tempo=240, time_signature=(3, 8))
  >>> m.notes
  array([[ 0. , 50. ,  1. , 60. ,  0. ],
         [ 0.5, 62. ,  0.5, 90. ,  0. ]])
  >>> m.unit = 'ticks'
  >>> m.notes
  array([[  0.,  50., 960.,  60.,   0.],
         [480.,  62., 480.,  90.,   0.]])
  >>> m.unit = 'beats'
  >>> m.notes
  array([[ 0., 50.,  4., 60.,  0.],
         [ 2., 62.,  2., 90.,  0.]])
class_docstr_tok: ["MIDI","File",".","Parameters","--","--","--","--","--","filename",":","str","MIDI","file","name",".","file_format",":","int",",","optional","MIDI","file","format","(","0",",","1",",","2",")",".","ticks_per_beat",":","int",",","optional","Resolution","(","i.e",".","ticks","per","quarter","note",")","of","the","MIDI","file",".","unit",":","str",",","optional","Unit","of","all","MIDI","messages",",","can","be","one","of","the","following",":","-","'ticks","'",",","'t","'",":","use","native","MIDI","ticks","as","unit",",","-","'seconds","'",",","'s","'",":","use","seconds","as","unit",",","-","'beats","'",",","'","b","'",":","use","beats","as","unit",".","timing",":","str",",","optional","Timing","of","all","MIDI","messages",",","can","be","one","of","the","following",":","-","'absolute","'",",","'abs","'",",","'","a","'",":","use","absolute","timing",".","-","'relative","'",",","'rel","'",",","'","r","'",":","use","relative","timing",",","i.e",".","delta","to","previous","message",".","Examples","--","--","--","--","Create","a","MIDI","file","from","an","array","with","notes",".","The","format","of","the","note","array","is",":","'onset","time","'",",","'pitch","'",",","'duration","'",",","'velocity","'",",","'channel","'",".","The","last","column","can","be","omitted",",","assuming","channel","0",".",">",">",">","notes","=","np.array","(","[","[","0",",","50",",","1",",","60","]",",","[","0.5",",","62",",","0.5",",","90","]","]",")",">",">",">","m","=","MIDIFile.from_notes","(","notes",")",">",">",">","m","#","doctest",":","+ELLIPSIS","<","madmom.io.midi.MIDIFile","object","at","0x","...",">","The","notes","can","be","accessed","as","a","numpy","array","in","various","formats","(","default","is","seconds",")",":",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","1.",",","60.",",","0",".","]",",","[","0.5",",","62.",",","0.5",",","90.",",","0",".","]","]",")",">",">",">","m.unit","='ticks'",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","960.",",","60.",",","0",".","]",",","[","480.",",","62.",",","480.",",","90.",",","0",".","]","]",")",">",">",">","m.unit","=","'seconds'",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","1.",",","60.",",","0",".","]",",","[","0.5",",","62.",",","0.5",",","90.",",","0",".","]","]",")",">",">",">","m.unit","=","'beats'",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","2.",",","60.",",","0",".","]",",","[","1.",",","62.",",","1.",",","90.",",","0",".","]","]",")",">",">",">","m","=","MIDIFile.from_notes","(","notes",",","tempo=60",")",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","1.",",","60.",",","0",".","]",",","[","0.5",",","62.",",","0.5",",","90.",",","0",".","]","]",")",">",">",">","m.unit","=","'ticks'",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","480.",",","60.",",","0",".","]",",","[","240.",",","62.",",","240.",",","90.",",","0",".","]","]",")",">",">",">","m.unit","=","'beats'",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","1.",",","60.",",","0",".","]",",","[","0.5",",","62.",",","0.5",",","90.",",","0",".","]","]",")",">",">",">","m","=","MIDIFile.from_notes","(","notes",",","time_signature=","(","2",",","2",")",")",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","1.",",","60.",",","0",".","]",",","[","0.5",",","62.",",","0.5",",","90.",",","0",".","]","]",")",">",">",">","m.unit","=","'ticks'",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","1920.",",","60.",",","0",".","]",",","[","960.",",","62.",",","960.",",","90.",",","0",".","]","]",")",">",">",">","m.unit","=","'beats'",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","2.",",","60.",",","0",".","]",",","[","1.",",","62.",",","1.",",","90.",",","0",".","]","]",")",">",">",">","m","=","MIDIFile.from_notes","(","notes",",","tempo=60",",","time_signature=","(","2",",","2",")",")",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","1.",",","60.",",","0",".","]",",","[","0.5",",","62.",",","0.5",",","90.",",","0",".","]","]",")",">",">",">","m.unit","=","'ticks'",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","960.",",","60.",",","0",".","]",",","[","480.",",","62.",",","480.",",","90.",",","0",".","]","]",")",">",">",">","m.unit","=","'beats'",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","1.",",","60.",",","0",".","]",",","[","0.5",",","62.",",","0.5",",","90.",",","0",".","]","]",")",">",">",">","m","=","MIDIFile.from_notes","(","notes",",","tempo=240",",","time_signature=","(","3",",","8",")",")",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","1.",",","60.",",","0",".","]",",","[","0.5",",","62.",",","0.5",",","90.",",","0",".","]","]",")",">",">",">","m.unit","=","'ticks'",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","960.",",","60.",",","0",".","]",",","[","480.",",","62.",",","480.",",","90.",",","0",".","]","]",")",">",">",">","m.unit","=","'beats'",">",">",">","m.notes","array","(","[","[","0.",",","50.",",","4.",",","60.",",","0",".","]",",","[","2.",",","62.",",","2.",",","90.",",","0",".","]","]",")"]
docstr: Notes of the MIDI file.
  
  Returns
  -------
  notes : numpy array
      Array with notes (onset time, pitch, duration, velocity, channel).
docstr_tok: ["Notes","of","the","MIDI","file",".","Returns","--","--","--","-","notes",":","numpy","array","Array","with","notes","(","onset","time",",","pitch",",","duration",",","velocity",",","channel",")","."]
code: def notes(self):
      """
      Notes of the MIDI file.
  
      Returns
      -------
      notes : numpy array
          Array with notes (onset time, pitch, duration, velocity, channel).
  
      """
      # lists to collect notes and sustain messages
      notes = []
      # dictionary for storing the last onset time and velocity for each
      # individual note (i.e. same pitch and channel)
      sounding_notes = {}
  
      # as key for the dict use channel * 128 (max number of pitches) + pitch
      def note_hash(channel, pitch):
          """Generate a note hash."""
          return channel * 128 + pitch
  
      # process all events
      for msg in self:
          # use only note on or note off events
          note_on = msg.type == "note_on"
          note_off = msg.type == "note_off"
          if not (note_on or note_off):
              continue
          # hash sounding note
          note = note_hash(msg.channel, msg.note)
          # start note if it's a 'note on' event with velocity > 0
          if note_on and msg.velocity > 0:
              # save the onset time and velocity
              sounding_notes[note] = (msg.time, msg.velocity)
          # end note if it's a 'note off' event or 'note on' with velocity 0
          elif note_off or (note_on and msg.velocity == 0):
              if note not in sounding_notes:
                  warnings.warn("ignoring MIDI message %s" % msg)
                  continue
              # append the note to the list
              notes.append(
                  (
                      sounding_notes[note][0],
                      msg.note,
                      msg.time - sounding_notes[note][0],
                      sounding_notes[note][1],
                      msg.channel,
                  )
              )
              # remove hash from dict
              del sounding_notes[note]
  
      # sort the notes and convert to numpy array
      return np.asarray(sorted(notes), dtype=float)
  
imports: from __future__ import absolute_import, division, print_function
  import warnings
  import mido
  import numpy
label_desc: Use image node_id 6 for calling the MIDIFile obj's underlying member method code with example usage: obj.notes() and returns: np, unknown