Skip to main content

Test & Release & Deploy PyPi PyPI pyversions MIT license

BPM Analyser (Beets Plugin)

The beets-bpmanalyser plugin lets you analyse the tempo of the songs you have in your library and write the bpm information on the bpm tag of your media files.

This plugin has a more powerful big brother which does much more than just extracting bpm: beets-xtractor plugin.

Installation

The plugin can be installed via:

pip install beets-bpmanalyser

It has three dependencies: numpy, aubio and pydub all of which are installed automatically when installing the plugin itself. Pydub is a wrapper library around ffmpeg or libav which are used to convert audio files to a temporary non-compressed (wav) version before running the aubio analysis on the song.

Usage

Activate the plugin in your configuration file:

plugins:
  - bpmanalyser
  # [...]

Check if plugin is loaded with beet version. It should list 'bpmanalyser' amongst the loaded plugins.

Your default configuration is:

bpmanalyser:
  auto: no
  dry-run: no
  write: yes
  threads: "AUTO"
  force: no
  quiet: no

By setting the auto option to yes, the plugin will be run automatically on each new item during import.

The other configuration options can also be set from the command line when running the plugin. Here are the options explained:

-d, --dry-run : Do not update the library or the media files. Only display the bpm values.

-f, --force : By default only songs with no bpm value (bpm:0) are analysed. Use this option to force the analysis regardless of the current bpm value.

-w, --write : Write the bpm values directly to the media files.

-t THREADS, --threads=THREADS: Set the number of processes to run in parallel. By default it is set to AUTO (threads: AUTO) and it will use half of the number of cores of your processor(s) have. You can set this to any number to specify how many concurrent threads you want to run.

-q, --quiet : Do not display any output from the command.

-v, --version : Displays the version number of the plugin.

Examples:

Calculate but show only (do not store) tempo information on all AC/DC songs:

$ beet bpmanalyser --dry-run artist:AC/DC

Update tempo information on all songs where it is missing:

$ beet bpmanalyser bpm:0

Force the update of tempo information on all songs where it has already been set:

$ beet bpmanalyser -f ^bpm:0

Accuracy

BPM values from acousticbrainz:

$ beet -c dev.yml acousticbrainz artist:AC/DC
acousticbrainz: getting data for: [format:MP3][bpm:121.106361389] ::: /_TmpMusic_/A/AC_DC/High Voltage/01. Baby, Please Don't Go.mp3
acousticbrainz: getting data for: [format:MP3][bpm:117.203399658] ::: /_TmpMusic_/A/AC_DC/High Voltage/02. She's Got Balls.mp3
acousticbrainz: getting data for: [format:MP3][bpm:106.826393127] ::: /_TmpMusic_/A/AC_DC/High Voltage/03. Little Lover.mp3
acousticbrainz: getting data for: [format:MP3][bpm:119.486862183] ::: /_TmpMusic_/A/AC_DC/High Voltage/04. Stick Around.mp3
acousticbrainz: getting data for: [format:MP3][bpm:133.189102173] ::: /_TmpMusic_/A/AC_DC/High Voltage/05. Soul Stripper.mp3
acousticbrainz: getting data for: [format:MP3][bpm:128.054992676] ::: /_TmpMusic_/A/AC_DC/High Voltage/06. You Ain't Got a Hold on Me.mp3
acousticbrainz: getting data for: [format:MP3][bpm:123.012046814] ::: /_TmpMusic_/A/AC_DC/High Voltage/07. Love Song.mp3
acousticbrainz: getting data for: [format:MP3][bpm:136.914703369] ::: /_TmpMusic_/A/AC_DC/High Voltage/08. Show Business.mp3

BPM values calculated by aubio:

$ beet -c dev.yml bpmanalyser artist:AC/DC -df
bpmanalyser: Song[/_TmpMusic_/A/AC_DC/High Voltage/01. Baby, Please Don't Go.mp3] bpm: 122
bpmanalyser: Song[/_TmpMusic_/A/AC_DC/High Voltage/02. She's Got Balls.mp3] bpm: 117
bpmanalyser: Song[/_TmpMusic_/A/AC_DC/High Voltage/03. Little Lover.mp3] bpm: 106
bpmanalyser: Song[/_TmpMusic_/A/AC_DC/High Voltage/04. Stick Around.mp3] bpm: 120
bpmanalyser: Song[/_TmpMusic_/A/AC_DC/High Voltage/05. Soul Stripper.mp3] bpm: 132
bpmanalyser: Song[/_TmpMusic_/A/AC_DC/High Voltage/06. You Ain't Got a Hold on Me.mp3] bpm: 128
bpmanalyser: Song[/_TmpMusic_/A/AC_DC/High Voltage/07. Love Song.mp3] bpm: 125
bpmanalyser: Song[/_TmpMusic_/A/AC_DC/High Voltage/08. Show Business.mp3] bpm: 139

Issues

If something is not working as expected please use the Issue tracker. If the documentation is not clear please use the Issue tracker. If you have a feature request please use the Issue tracker. In any other situation please use the Issue tracker.

Other plugins by the same author

Acknowledgements

Many thanks to the developers and contributors of the beets check plugin. Some structural concepts and best practices were adopted to get started on this plugin.

Final Remarks

Enjoy!

Release files for beets-bpmanalyser 1.5.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for beets-bpmanalyser 1.5.9
File Size Uploaded
beets_bpmanalyser-1.5.9.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for beets-bpmanalyser 1.5.9
File Interpreter ABI Platform
beets_bpmanalyser-1.5.9-py3-none-any.whl Python 3 none any Details

Total release size: 17.2 kB

Release files / beets_bpmanalyser-1.5.9.tar.gz

Download URL beets_bpmanalyser-1.5.9.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8965d210b1911c8e1a93531358249d462c8fcfad7c7f2052ccac3f15e262819e
BLAKE2b-256 checksum
How to use checksums
fc8a9e7f7fd3b87ba0d1a5c50f66c436444f8a21c6baeef792a9395e5d358a9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release files / beets_bpmanalyser-1.5.9-py3-none-any.whl

Download URL beets_bpmanalyser-1.5.9-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab33f761c9dff66e150d29466f48fea7ea9a3d0eacdf59230daafd4380c60925
BLAKE2b-256 checksum
How to use checksums
3d84476a57a0f770dc03350d295310aafce2a56a32aaae889c66b8cc286b7693
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.5.9 This release

2 release files

1.5.8

2 release files

1.5.7

2 release files

1.5.6

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page