Skip to content

Instantly share code, notes, and snippets.

@zopieux
Created August 11, 2024 17:59
Show Gist options
  • Save zopieux/d2428ad9e906022c3a4c2fda85e00688 to your computer and use it in GitHub Desktop.
Save zopieux/d2428ad9e906022c3a4c2fda85e00688 to your computer and use it in GitHub Desktop.
BPM detection with essentia
import essentia
import essentia.standard as es
# Initialize the audio loader
loader = es.MonoLoader(filename='path_to_your_audio_file.mp3')
# Load the audio
audio = loader()
# Initialize the RhythmExtractor2013
rhythm_extractor = es.RhythmExtractor2013()
# Compute BPM and other rhythm features
bpm, beats, beats_confidence, _, beats_intervals = rhythm_extractor(audio)
print(f"Estimated BPM: {bpm}")
print(f"Beat positions (seconds): {beats}")
print(f"Beats confidence: {beats_confidence}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment