code: def intervals_to_samples(intervals, labels, offset=0, sample_size=0.1,
                           fill_value=None):
      
  
      # Round intervals to the sample size
      num_samples = int(np.floor(intervals.max() / sample_size))
      sample_indices = np.arange(num_samples, dtype=np.float32)
      sample_times = (sample_indices*sample_size + offset).tolist()
      sampled_labels = interpolate_intervals(
          intervals, labels, sample_times, fill_value)
  
      return sample_times, sampled_labels
docs: Convert an array of labeled time intervals to annotated samples.
  
      Parameters
      ----------
      intervals : np.ndarray, shape=(n, d)
          An array of time intervals, as returned by
          :func:`mir_eval.io.load_intervals()` or
          :func:`mir_eval.io.load_labeled_intervals()`.
          The ``i`` th interval spans time ``intervals[i, 0]`` to
          ``intervals[i, 1]``.
  
      labels : list, shape=(n,)
          The annotation for each interval
  
      offset : float > 0
          Phase offset of the sampled time grid (in seconds)
          (Default value = 0)
  
      sample_size : float > 0
          duration of each sample to be generated (in seconds)
          (Default value = 0.1)
  
      fill_value : type(labels[0])
          Object to use for the label with out-of-range time points.
          (Default value = None)
  
      Returns
      -------
      sample_times : list
          list of sample times
  
      sample_labels : list
          array of labels for each generated sample
  
      Notes
      -----
          Intervals will be rounded down to the nearest multiple
          of ``sample_size``.