Skip to main content

A beets plugin for the deeprhythm tempo predictor

Project description

BeetRhythm - Beets Plugin for DeepRhythm Tempo Prediction

A beets plugin that uses DeepRhythm to predict tempo (BPM) for your music library with high accuracy and speed.

Features

  • Automatic tempo prediction during music import
  • Batch processing for efficient analysis of large collections
  • High accuracy using the DeepRhythm CNN model (95.91% accuracy)
  • Fast processing with GPU acceleration support
  • Flexible configuration with confidence thresholds and device selection
  • CLI command for manual processing of specific files or folders

Installation

  1. Install the plugin:
poetry install
  1. Install DeepRhythm:
pip install deeprhythm
  1. Add the plugin to your beets configuration:
plugins:
  - beetrhythm

beetrhythm:
  auto: true              # Automatically predict tempo on import
  write: true             # Write tempo to file tags
  force: false            # Overwrite existing tempo values
  device: auto            # Device for prediction (auto, cpu, cuda, mps)
  batch_size: 128         # Batch size for processing
  workers: 8              # Number of workers for batch processing
  confidence_threshold: 0.0  # Minimum confidence threshold (0.0-1.0)

Usage

Automatic Mode

When auto: true is set in configuration, the plugin will automatically predict tempo for:

  • Albums imported with beet import
  • Individual tracks imported as singletons

Manual CLI Command

Use the beet beetrhythm command to manually process files or folders:

# Process all items in library without tempo
beet beetrhythm

# Process specific folder
beet beetrhythm /path/to/music/folder

# Process specific files
beet beetrhythm /path/to/song1.mp3 /path/to/song2.flac

# Show confidence scores
beet beetrhythm -c /path/to/music

# Force overwrite existing tempo values
beet beetrhythm -f /path/to/music

# Use specific device
beet beetrhythm -d cuda /path/to/music

# Don't write to file tags (database only)
beet beetrhythm --no-write /path/to/music

Command Options

  • -f, --force: Overwrite existing tempo values
  • -w, --write: Write tempo to file tags (default: true)
  • --no-write: Don't write tempo to file tags
  • -c, --confidence: Show confidence scores
  • -d, --device: Device for prediction (auto, cpu, cuda, mps)

Configuration Options

Option Default Description
auto true Automatically predict tempo during import
write true Write tempo values to file tags
force false Overwrite existing tempo values
device auto Device for prediction (auto, cpu, cuda, mps)
batch_size 128 Batch size for processing
workers 8 Number of workers for batch processing
confidence_threshold 0.0 Minimum confidence threshold (0.0-1.0)

Database Fields

The plugin adds the following flexible fields to your beets database:

  • bpm: The predicted tempo in beats per minute (float)
  • bpm_confidence: The confidence score of the prediction (float, 0.0-1.0)

You can query these fields like any other beets field:

# Find songs with tempo between 120-140 BPM
beet list bpm:120..140

# Find songs with high confidence predictions
beet list bpm_confidence:0.9..

# Find songs without tempo predictions
beet list bpm:^$

Performance

The plugin uses batch processing when possible to greatly reduce processing time, especially when processing entire directories.

Requirements

  • Python 3.8+
  • beets
  • deeprhythm
  • PyTorch (installed automatically with deeprhythm)

Troubleshooting

DeepRhythm not found

If you get an error about DeepRhythm not being installed:

pip install deeprhythm

GPU not detected

If you have a CUDA-capable GPU but it's not being used:

  • Ensure you have the CUDA version of PyTorch installed
  • Set device: cuda in your configuration
  • Check that your GPU drivers are up to date

Memory issues

If you encounter memory issues with large batches:

  • Reduce batch_size in configuration
  • Reduce workers count
  • Use device: cpu instead of GPU

License

This project is licensed under the same terms as the beets project.

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beetrhythm-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

beetrhythm-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file beetrhythm-0.1.0.tar.gz.

File metadata

  • Download URL: beetrhythm-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.9 Darwin/24.5.0

File hashes

Hashes for beetrhythm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 71c259fa20f476f72b5a25d4b5d1397df3e94287d6206475207b871ed6b8e6ed
MD5 bad357988c2a947f89b4a9fdf40406a2
BLAKE2b-256 679e6bfa52923070c7813086cae22d0eb5c87b7a7f8744a9bf7a7c09b6aac483

See more details on using hashes here.

File details

Details for the file beetrhythm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: beetrhythm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.9 Darwin/24.5.0

File hashes

Hashes for beetrhythm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 327aaeb79c7f040359bc6f7a0b1fa82a8ec6b6e4038dc7ab23a1fe51f63a466b
MD5 6031e3aa468cf20161da3f7550e142ff
BLAKE2b-256 0dfc2677ce844f897395c2145c382287b1d1c0bed7b27f2656be9d101afc8333

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page