Automatic song tempo aligner
The program aligns the tempo of a music file to match an ideal metronome.
Audio pitch is preserved.
The bpm value (beats per minute) should be set by the user, but the program
prints the average bpm it found in the original audio. Beats are recognized in
the audio file by importing labels from an Audacity project.
One can take an original recording and align the tempo, so that it can be
imported to a DAW (Digital Audio Workstation). This is an important feature
if one wants to record a cover of the recording with a metronome. Importing
the original directly would result in a misalignment, which would make it
inconvenient to work with.
python3 tempoligner --input input.mp3 --output output.flac --aup project.aup --bpf 2 --bpm 100
The aligned song is written to output.flac
in this example and is aligned
to an ideal 100 bpm metronome (but see Limitations below). It is assumed
that labels are placed in Audacity project each two beats (--bpf
argument).
Note: currently only mp3 input is supported.
The code is written in Python 3.
Use
pip install -r requirements.txt
to install the dependencies.
Actually, the output is not aligned to an ideal metronome, but will drift
slightly over time due to inexact segment durations. Typically the drift won’t
exceed 100 ms over a 4 min audio file. There is a plan to remove the drift
and make the output ideally aligned.
There are slight signal distortions around labels. Depending on the type of
music this may or may not be a big issue. Just try and check if it’s
acceptable for your use case.
Copyright (C) 2018, Michał Szymański