Module bpm

Module bpm 

Source
Expand description

BPM estimation via onset-strength autocorrelation.

Reads raw PCM data from WAV and AIFF files, computes an energy envelope, derives onset strength, then uses autocorrelation to find the dominant tempo in the 50โ€“220 BPM range.

Functionsยง

decode_pcm ๐Ÿ”’
Decode raw PCM bytes to mono f32 samples, normalized to [-1, 1].
decode_with_symphonia ๐Ÿ”’
Decode compressed audio (MP3, FLAC, OGG, M4A, AAC) via symphonia. Returns mono f32 samples + sample rate, or None on failure.
decode_with_symphonia_pub
detect_tempo ๐Ÿ”’
Detect tempo using onset-strength autocorrelation.
estimate_bpm
Estimate BPM for an audio file. Returns None for unsupported formats, unreadable files, or when no clear tempo is detected.
read_aiff_pcm ๐Ÿ”’
Read AIFF file and return mono f32 samples + sample rate.
read_aiff_pcm_pub
read_wav_pcm ๐Ÿ”’
Read WAV file and return mono f32 samples + sample rate.
read_wav_pcm_pub