code: def pulseTrain(self, bpm, sr, offset, dur):
      from math import floor
  
      period = int(floor(sr / (bpm / 60.0)))
      size = int(floor(sr * dur))
      phase = int(floor(offset * sr))
  
      if phase > period:
          phase = 0
  
      impulse = [0.0] * size
      for i in range(size):
          if i % period == phase:
              impulse[i] = 1.0
      return impulse
  
file_path: essentia/test/src/unittests/rhythm/test_rhythmextractor.py
imports: from essentia_test import *
  from essentia.streaming import RhythmExtractor
  from essentia.standard import MonoLoader, RhythmExtractor
  from math import fabs
label_desc: Use image node_id 3 for calling the TestRhythmExtractor obj's underlying member method code with example usage: obj.pulseTrain(bpm, sr, offset, dur) and returns: impulse