code: def _n_onset_midi(patterns):
      
      return len([o_m for pat in patterns for occ in pat for o_m in occ])
docs: Computes the number of onset_midi objects in a pattern
  
      Parameters
      ----------
      patterns :
          A list of patterns using the format returned by
          :func:`mir_eval.io.load_patterns()`
  
      Returns
      -------
      n_onsets : int
          Number of onsets within the pattern.