code: def pitch(times, frequencies, midi=False, unvoiced=False, ax=None, **kwargs):
      '''Visualize pitch contours
      Parameters
      ----------
      times : np.ndarray, shape=(n,)
          Sample times of frequencies
      frequencies : np.ndarray, shape=(n,)
          frequencies (in Hz) of the pitch contours.
          Voicing is indicated by sign (positive for voiced,
          non-positive for non-voiced).
      midi : bool
          If `True`, plot on a MIDI-numbered vertical axis.
          Otherwise, plot on a linear frequency axis.
      unvoiced : bool
          If `True`, unvoiced pitch contours are plotted and indicated
          by transparency.
          Otherwise, unvoiced pitch contours are omitted from the display.
      ax : matplotlib.pyplot.axes
          An axis handle on which to draw the pitch contours.
          If none is provided, a new set of axes is created.
      kwargs
          Additional keyword arguments to `matplotlib.pyplot.plot`.
      Returns
      -------
      ax : matplotlib.pyplot.axes._subplots.AxesSubplot
          A handle to the (possibly constructed) plot axes
      '''
      ax, _ = __get_axes(ax=ax)
      times = np.asarray(times)
      frequencies, voicings = freq_to_voicing(np.asarray(frequencies,
                                                         dtype=np.float))
      v_changes = 1 + np.flatnonzero(voicings[1:] != voicings[:-1])
      v_changes = np.unique(np.concatenate([[0], v_changes, [len(voicings)]]))
      v_slices, u_slices = [], []
      for start, end in zip(v_changes, v_changes[1:]):
          idx = slice(start, end)
          if voicings[start]:
              v_slices.append(idx)
          elif frequencies[idx].all():
              u_slices.append(idx)
      style = dict()
      style.update(next(ax._get_lines.prop_cycler))
      style.update(kwargs)
      if midi:
          idx = frequencies > 0
          frequencies[idx] = hz_to_midi(frequencies[idx])
          ax.yaxis.set_minor_locator(MultipleLocator(1))
      for idx in v_slices:
          ax.plot(times[idx], frequencies[idx], **style)
          style.pop('label', None)
      if unvoiced:
          style['alpha'] = style.get('alpha', 1.0) * 0.5
          for idx in u_slices:
              ax.plot(times[idx], frequencies[idx], **style)
      return ax