code: def testRealSignal(self):
      sr = 8000
      # Pure tone:
      sig = [sin(2 * pi * 440.0 * i / float(sr)) for i in range(sr)]
      sineSalience = mean(self.computePitchSalience(sig, sr))
  
      # Sine weep:
      sig = [
          sin(2 * pi * (20 + 440.0 * i / float(sr)) * i / float(sr))
          for i in range(sr)
      ]
      sweepSalience = mean(self.computePitchSalience(sig, sr))
  
      # white noise salience:
      sig = array(uniform(size=sr))
      noiseSalience = mean(self.computePitchSalience(sig, sr))
  
      # square wave salience
      stepSize = 40
      step = 0.5
      sig = []
      for i in range(0, sr, stepSize):
          step *= -1
          sig += [step] * stepSize
      sqrSalience = mean(self.computePitchSalience(sig, sr))
  
      # varying sqr wave:
      stepSize = 10
      step = 0.5
      sig = []
      for i in range(0, sr, int(stepSize)):
          step *= -1
          stepSize = 10 + int(100 * i / sr)
          sig += [step] * stepSize
      varSqrSalience = mean(self.computePitchSalience(sig, sr))
  
      # print("noise: %f" % noiseSalience)
      # print("sine: %f" % sineSalience)
      # print("sweep: %f" % sweepSalience)
      # print("square: %f" % sqrSalience)
      # print("var square %f:" % varSqrSalience)
      self.assertTrue(sineSalience < sweepSalience)
      self.assertTrue(sweepSalience < noiseSalience)
      self.assertTrue(noiseSalience < varSqrSalience)
      self.assertTrue(varSqrSalience < sqrSalience)
  
file_path: essentia/test/src/unittests/sfx/test_pitchsalience.py
imports: from essentia_test import *
  from numpy import sin, pi, mean, var
  from numpy.random import uniform
label_desc: Use image node_id 2 for calling the TestPitchSalience obj's underlying member method code with example usage: obj.testRealSignal() without return types