Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

163 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maddad

Toolkit for beat detection.

Installation

You can install by pip.

pip install git+https://github.com/tky823/maddad.git

or clone this repository.

git clone https://github.com/tky823/maddad.git
cd maddad
pip install -e .

Usage

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])

License

  • CC BY-NC 4.0

About

Toolkit for beat detection.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages