code: def test_spectral_centroid(infile):
      DATA = load(infile)
  
      y, sr = librosa.load(
          os.path.join("tests", DATA["wavfile"][0]), sr=None, mono=True
      )
  
      n_fft = DATA["nfft"][0, 0].astype(int)
      hop_length = DATA["hop_length"][0, 0].astype(int)
  
      # spectralCentroid uses normalized spectra
      S = met_stft(y, n_fft, hop_length, n_fft, True)
  
      centroid = librosa.feature.spectral_centroid(
          S=S, sr=sr, n_fft=n_fft, hop_length=hop_length
      )
  
      assert np.allclose(centroid, DATA["centroid"])
  
file_path: librosa/tests/test_met_features.py
imports: import os
  import pytest
  import numpy
  import scipy.io
  import scipy.signal
  from test_core import load, files
  import librosa
label_desc: Use image node_id 2 for calling a global function with example usage: test_spectral_centroid(infile) without return types