code: def testImpulseTrain(self):
      inputLength = 14200
      numberFrames = 1024
      featuresNumber = 1
      guessPeriod = 70
      guessPhase = 17
  
      # create an impulse train of phase 17 and period 70
      features = zeros((inputLength, featuresNumber))
      i = int(math.floor(guessPhase))
      while i < len(features):
          features[i][0] = 1
          i += int(math.floor(guessPeriod))
  
      tempotap = TempoTap(
          numberFrames=numberFrames, frameHop=numberFrames
      )
  
      periodEstimates = []
      phaseEstimates = []
  
      for i in range(inputLength):
          periods, phases = tempotap(features[i])
  
          periodEstimates += list(periods)
          phaseEstimates += list(phases)
  
      # flush current buffer with zeros
      for i in range(inputLength % numberFrames, numberFrames):
          periods, phases = tempotap(zeros(featuresNumber))
  
          periodEstimates += list(periods)
          phaseEstimates += list(phases)
  
      # check that we have as many candidates as expected
      expectedSize = round(
          float(featuresNumber) * inputLength / numberFrames
      )
      self.assertEqual(len(periodEstimates), expectedSize)
      self.assertEqual(len(phaseEstimates), expectedSize)
  
      # check that the first candidates fit with trial input
      self.assertEqual(round(periodEstimates[0]), guessPeriod)
      self.assertEqual(round(phaseEstimates[0]), guessPhase)
  
      # construct the beats train from the period and estimates candidates and
      # make sure we find a corresponding impulse in the input
      i = 0
      while i < len(phaseEstimates):
          while phaseEstimates[i] < numberFrames:
              currentBeat = round(phaseEstimates[i] + i * numberFrames)
              if currentBeat > inputLength:
                  break
              self.assertEqual(features[int(currentBeat)][0], 1)
              phaseEstimates[i] += round(periodEstimates[i])
          i += 1
  
file_path: essentia/test/src/unittests/rhythm/test_tempotap.py
imports: from essentia_test import *
  import math
label_desc: Use image node_id 4 for calling the TestTempoTap obj's underlying member method code with example usage: obj.testImpulseTrain() without return types