code: def compute_num_true_positives(ref_freqs, est_freqs, window=0.5, chroma=False):
      
      n_frames = len(ref_freqs)
      true_positives = np.zeros((n_frames, ))
  
      for i, (ref_frame, est_frame) in enumerate(zip(ref_freqs, est_freqs)):
          if chroma:
              # match chroma-wrapped frequency events
              matching = util.match_events(
                  ref_frame, est_frame, window,
                  distance=util._outer_distance_mod_n)
          else:
              # match frequency events within tolerance window in semitones
              matching = util.match_events(ref_frame, est_frame, window)
  
          true_positives[i] = len(matching)
  
      return true_positives
docs: Compute the number of true positives in an estimate given a reference.
      A frequency is correct if it is within a quartertone of the
      correct frequency.
  
      Parameters
      ----------
      ref_freqs : list of np.ndarray
          reference frequencies (MIDI)
      est_freqs : list of np.ndarray
          estimated frequencies (MIDI)
      window : float
          Window size, in semitones
      chroma : bool
          If True, computes distances modulo n.
          If True, ``ref_freqs`` and ``est_freqs`` should be wrapped modulo n.
  
      Returns
      -------
      true_positives : np.ndarray
          Array the same length as ref_freqs containing the number of true
          positives.