docs: def process_buffer(buffer, n_channels):
      """
      Merge the read blocks and resample if necessary.
  
      Args:
          buffer (list): A list of blocks of samples.
          n_channels (int): The number of channels of the input data.
  
      Returns:
          np.array: The samples
      """
      samples = np.concatenate(buffer)
  
      if n_channels > 1:
          samples = samples.reshape((-1, n_channels)).T
          samples = librosa.to_mono(samples)
  
      return samples