phasefinder is a beat estimation model that predicts metric position as rotational phase, heavily inspired by this paper.
from phasefinder import Phasefinder
# initialize model
pf = Phasefinder()
# predict beats
audio_path = "path/to/your/audio/file.[wav/mp3/flac/etc]"
beat_times = pf.predict(audio_path)
# predict beats and BPM
beat_times, bpm = pf.predict(audio_path, include_bpm=True)
# generate a click track
output_path = "output_with_clicks.wav"
pf.make_click_track(audio_path, output_path, beats=beat_times)
python -m phasefinder.infer path/to/your/audio/file.wav
This will print the estimated beat times to the console.
--bpm
: Include BPM in the output--noclean
: Don't apply the cleaning function to the beat times--format {times,click_track}
: Choose the output format (default: times)times
: Output beat timesclick_track
: Generate an audio file with click track
--audio_output PATH
: Specify the path for the output audio file with clicks (default: output_with_clicks.wav)--json_output PATH
: Save the results to a JSON file
-
Estimate beats and BPM:
python -m phasefinder.infer path/to/audio.wav --bpm
-
Generate a click track:
python -m phasefinder.infer path/to/audio.wav --format click_track --audio_output output.wav
-
Save results to a JSON file:
python -m phasefinder.infer path/to/audio.wav --bpm --json_output results.json
-
Estimate beats without applying the cleaning function:
python -m phasefinder.infer path/to/audio.wav --noclean