Toolkit for beat detection.
You can install by pip.
pip install git+https://github.com/tky823/maddad.gitor clone this repository.
git clone https://github.com/tky823/maddad.git
cd maddad
pip install -e .From file:
>>> from maddad.pipelines.beat_and_downbeat import BeatThisPipeline
>>> audio_path = "audio.mp3"
>>> decoder = "dbn" # "minimal" or "dbn"
>>> pipeline = BeatThisPipeline.build_from_pretrained("official_beatthis", decoder=decoder, device="cpu")
>>> output = pipeline(audio_path)
>>> output["beat"]
tensor([ 0.0600, 0.8400, ..., 40.7000])
>>> output["downbeat"]
tensor([ 0.0600, 3.1200, ..., 39.8200])From tensor:
>>> import torchaudio
>>> from maddad.pipelines.beat_and_downbeat import BeatThisPipeline
>>> audio_path = "audio.mp3"
>>> decoder = "dbn" # "minimal" or "dbn"
>>> waveform, sample_rate = torchaudio.load(audio_path)
>>> waveform = waveform.mean(dim=0) # Channel dimension should be removed.
>>> pipeline = BeatThisPipeline.build_from_pretrained("official_beatthis", decoder=decoder, device="cpu")
>>> output = pipeline(waveform, sample_rate=sample_rate)
>>> output["beat"]
tensor([ 0.0600, 0.8400, ..., 40.7000])
>>> output["downbeat"]
tensor([ 0.0600, 3.1200, ..., 39.8200])- CC BY-NC 4.0