code: def spectral_centroid(signal, fs):
      """Barycenter of the spectrum.
  
      Description and formula in Article:
      The Timbre Toolbox: Extracting audio descriptors from musicalsignals
      Authors Peeters G., Giordano B., Misdariis P., McAdams S.
  
      Feature computational cost: 2
  
      Parameters
      ----------
      signal : nd-array
          Signal from which spectral centroid is computed
      fs: int
          Sampling frequency
  
      Returns
      -------
      float
          Centroid
  
      """
      f, fmag = calc_fft(signal, fs)
      if not np.sum(fmag):
          return 0
      else:
          return np.dot(f, fmag / np.sum(fmag))
  
imports: import scipy.signal
  from tsfel.feature_extraction.features_utils import *
label_desc: Use image node_id 41 for calling a global function with example usage: spectral_centroid(signal, fs) and returns: int, np