code: def testRegression(self):
      audio = MonoLoader(
          filename=join(testdata.audio_dir, "recorded/techno_loop.wav"),
          sampleRate=44100,
      )()
      frames = FrameGenerator(
          audio, frameSize=framesize, hopSize=hopsize
      )
      win = Windowing(type="hamming")
      fft = FFT()
      onset_hfc = OnsetDetection(method="hfc")
      onset_complex = OnsetDetection(method="complex")
      onset_complex_phase = OnsetDetection(method="complex_phase")
      onset_melflux = OnsetDetection(method="melflux")
      onset_flux = OnsetDetection(method="flux")
      onset_rms = OnsetDetection(method="rms")
  
      hfc_out = []
      complex_out = []
      complex_phase_out = []
      melflux_out = []
      flux_out = []
      rms_out = []
  
      for frame in frames:
          fft_frame = fft(win(frame))
          mag, ph = CartesianToPolar()(fft_frame)
          hfc_out += [onset_hfc(mag, ph)]
          complex_out += [onset_complex(mag, ph)]
          complex_phase_out += [onset_complex_phase(mag, ph)]
          melflux_out += [onset_melflux(mag, ph)]
          flux_out += [onset_flux(mag, ph)]
          rms_out += [onset_rms(mag, ph)]
  
      """
          This code was used to obtain reference samples for storing in a file.
          save('hfc.npy', hfc_out)
          save('complex.npy', complex_out)
          save('complex_phase.npy', complex_phase_out)
          save('melflux.npy', melflux_out)
          save('flux.npy', flux_out)                
          save('rms.npy', rms_out)                
          """
  
      # Reference samples are loaded as expected values
      expected_hfc = load(join(filedir(), "onsetdetection/hfc.npy"))
      expected_complex = load(
          join(filedir(), "onsetdetection/complex.npy")
      )
      expected_complex_phase = load(
          join(filedir(), "onsetdetection/complex_phase.npy")
      )
      expected_melflux = load(
          join(filedir(), "onsetdetection/melflux.npy")
      )
      expected_flux = load(join(filedir(), "onsetdetection/flux.npy"))
      expected_rms = load(join(filedir(), "onsetdetection/rms.npy"))
  
      self.assertAlmostEqualVectorFixedPrecision(
          hfc_out, expected_hfc, 1
      )
      self.assertAlmostEqualVectorFixedPrecision(
          complex_out, expected_complex, 4
      )
      self.assertAlmostEqualVectorFixedPrecision(
          complex_phase_out, expected_complex_phase, 4
      )
      self.assertAlmostEqualVectorFixedPrecision(
          melflux_out, expected_melflux, 2
      )
      self.assertAlmostEqualVectorFixedPrecision(
          flux_out, expected_flux, 4
      )
      self.assertAlmostEqualVectorFixedPrecision(
          rms_out, expected_rms, 4
      )
  
file_path: essentia/test/src/unittests/rhythm/test_onsetdetection.py
imports: from numpy import *
  from essentia_test import *
label_desc: Use image node_id 6 for calling the TestOnsetDetection obj's underlying member method code with example usage: obj.testRegression() without return types