code: def testRegressionStartAtZero(self):
      # The test audio files for loudness are provided in EBU Tech 3341
      # https://tech.ebu.ch/docs/tech/tech3341.pdf
  
      # Test zero-centered. When startAtZero=True, the loudness measurement
      # windows are centered at zero position in time producing the fadein
      # and fadeout effect at the start and the end of the signal. Estimate
      # the number of the affected values from windows/hop size
  
      # Default hopSize = 0.1 s
      # Momentary loudness window size = 0.4 s
      # Short-term loudness window size = 3 s
  
      fade_size_m = round((0.4 / 2) / 0.1)
      fade_size_s = round((3.0 / 2) / 0.1)
  
      # M, S, I = -20 +- 0.1 LUFS
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "1kHz_sine_-20LUFS-16bit.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
  
      m, s, i, r = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      m = m[fade_size_m:-fade_size_m]
      s = s[fade_size_s:-fade_size_s]
      self.assertAlmostEqualVector(
          m, essentia.array([-20.0] * len(m)), 0.1
      )
      self.assertAlmostEqualVector(
          s, essentia.array([-20.0] * len(s)), 0.1
      )
      self.assertAlmostEqual(i, -20.0, 0.1)
  
      # M, S, I = -26 +- 0.1 LUFS
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "1kHz_sine_-26LUFS-16bit.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      m, s, i, r = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      m = m[fade_size_m:-fade_size_m]
      s = s[fade_size_s:-fade_size_s]
      self.assertAlmostEqualVector(
          m, essentia.array([-26.0] * len(m)), 0.1
      )
      self.assertAlmostEqualVector(
          s, essentia.array([-26.0] * len(s)), 0.1
      )
      self.assertAlmostEqual(i, -26.0, 0.1)
  
      # M, S, I = -40 +- 0.1 LUFS
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "1kHz_sine_-40LUFS-16bit.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      m, s, i, r = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      m = m[fade_size_m:-fade_size_m]
      s = s[fade_size_s:-fade_size_s]
      self.assertAlmostEqualVector(
          m, essentia.array([-40.0] * len(m)), 0.1
      )
      self.assertAlmostEqualVector(
          s, essentia.array([-40.0] * len(s)), 0.1
      )
      self.assertAlmostEqual(i, -40.0, 0.1)
  
      # M, S, I = -23 +- 0.1 LUFS
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "seq-3341-1-16bit.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      m, s, i, r = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      m = m[fade_size_m:-fade_size_m]
      s = s[fade_size_s:-fade_size_s]
      self.assertAlmostEqualVector(
          m, essentia.array([-23.0] * len(m)), 0.1
      )
      self.assertAlmostEqualVector(
          s, essentia.array([-23.0] * len(s)), 0.1
      )
      self.assertAlmostEqual(i, -23.0, 0.1)
  
      # M, S, I = -33 +- 0.1 LUFS
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "seq-3341-2-16bit.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      m, s, i, r = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      m = m[fade_size_m:-fade_size_m]
      s = s[fade_size_s:-fade_size_s]
      self.assertAlmostEqualVector(
          m, essentia.array([-33.0] * len(m)), 0.1
      )
      self.assertAlmostEqualVector(
          s, essentia.array([-33.0] * len(s)), 0.1
      )
      self.assertAlmostEqual(i, -33.0, 0.1)
  
      # I = -23 +- 0.1 LUFS
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "seq-3341-3-16bit-v02.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      _, _, i, _ = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      self.assertAlmostEqual(i, -23.0, 0.1)
  
      # I = -23 +- 0.1 LUFS
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "seq-3341-4-16bit-v02.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      _, _, i, _ = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      self.assertAlmostEqual(i, -23.0, 0.1)
  
      # I = -23 +- 0.1 LUFS
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "seq-3341-5-16bit-v02.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      _, _, i, _ = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      self.assertAlmostEqual(i, -23.0, 0.1)
  
      # I = -23 +- 0.1 LUFS
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "seq-3341-7_seq-3342-5-16bit.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      _, _, i, _ = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      self.assertAlmostEqual(i, -23.0, 0.1)
  
      # Test audio files for dynamic range are provided in EBU Tech Doc 3342
      # https://tech.ebu.ch/docs/tech/tech3342.pdf
  
      # LRA = 10 +- 1 LU
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "seq-3342-1-16bit.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      _, _, i, _ = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      self.assertAlmostEqual(r, 10.0, 1.0)
  
      # LRA = 5 +- 1 LU
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "seq-3342-2-16bit.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      _, _, _, r = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      self.assertAlmostEqual(r, 5.0, 1.0)
  
      # LRA = 20 +- 1 LU
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "seq-3342-3-16bit.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      _, _, _, r = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      self.assertAlmostEqual(r, 20.0, 1.0)
  
      # LRA = 15 +- 1 LU
      filename = join(
          testdata.audio_dir,
          "generated",
          "ebur128",
          "seq-3342-4-16bit.flac",
      )
      audio, samplerate, _, _, _, _ = AudioLoader(filename=filename)()
      _, _, _, r = LoudnessEBUR128(
          sampleRate=samplerate, hopSize=0.1, startAtZero=True
      )(audio)
      self.assertAlmostEqual(r, 15.0, 1.0)
  
imports: from essentia_test import *
label_desc: Use image node_id 2 for calling the TestLoudnessEBUR128 obj's underlying member method code with example usage: obj.testRegressionStartAtZero() without return types