Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def compute_beats(audio):
"""Computes the beats using Essentia."""
logging.info("Computing Beats...")
conf = 1.0
beats, conf = ES.BeatTrackerMultiFeature()(audio)
# beats = ES.BeatTrackerDegara()(audio)
beats *= 44100 / msaf.Anal.sample_rate # Essentia requires 44100 input
# Double the beats if found beats are too little
th = 0.9 # 1 would equal to at least 1 beat per second
while beats.shape[0] / (audio.shape[0] / float(msaf.Anal.sample_rate)) < th \
and beats.shape[0] > 2:
beats = double_beats(beats)
return beats, conf
def compute_beats(audio):
"""Computes the beats using Essentia."""
logging.info("Computing Beats...")
ticks, conf = ES.BeatTrackerMultiFeature()(audio)
return ticks, conf