Skip to main content

autochord

Automatic Chord Recognition tools

About

autochord is:

✔ a Python library for automatic chord recognition (using TensorFlow)

✔ a Javascript app for visualization of chord transcriptions:

Library Usage

To install library, run:

$ pip install autochord

autochord provides a very simple API for performing chord recognition:

import autochord
autochord.recognize('audio.wav', lab_fn='chords.lab')
# This gives out a list of tuples in the format:
#  (chord start, chord end, chord name)
# e.g.
# [(0.0, 5.944308390022676, 'D:maj'),
#  (5.944308390022676, 7.476825396825397, 'C:maj'),
#  (7.476825396825397, 18.250884353741498, 'D:maj'),
#  (18.250884353741498, 19.736961451247165, 'C:maj')
#  ...
#  (160.49632653061224, 162.30748299319728, 'N')]

Under the hood autochord.recognize() runs the NNLS-Chroma VAMP plugin to extract chroma features from the audio, and feeds it to a Bi-LSTM-CRF model in TensorFlow to recognize the chords. Currently, the model can recognize 25 chord classes: the 12 major triads, 12 minor triads, and no-chord ('N').

OPTIONALLY, you may dump the chords in a .lab file by using the lab_fn parameter. The output file follows the MIREX chord label format.

Upon import autochord takes care of setting up the VAMP plugin and downloading the pre-trained chord recognition model.

The measured test accuracy of the TensorFlow model is 67.33%. That may be enough for some songs, but we can explore in the future how to further improve this.

App Usage

The app is pretty straightforward: you need to load a song, then you can upload a LAB file to visualize its chord labels. You may use the autochord Python library for generating this file. Optionally, you may load another LAB file for comparison (e.g. ground-truth labels, LAB file from another model's prediction).

Future Improvements

  • Integrate everything into a full chord recognition app! For that we need to:
    • convert VAMP plugin to JS module
    • model conversion to TensorFlow.js (as of writing, some CRF operations are not supported by TFJS yet)
    • converting all other Python functions to JS equivalent
  • Experimenting with other approaches to improve chord recognition accuracy

Metadata

Release files for autochord 0.1.4

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

Source distribution (sdist)

Source distribution for autochord 0.1.4
File Size Uploaded Provenance Actions
autochord-0.1.4.tar.gz 345.0 kB Without provenance Details for autochord-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for autochord 0.1.4
File Interpreter ABI Platform Actions
autochord-0.1.4-py3-none-any.whl Python 3 none any Details for autochord-0.1.4-py3-none-any.whl

Total release size: 695.3 kB

Release files / autochord-0.1.4.tar.gz

Download URL autochord-0.1.4.tar.gz
Size 345.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6634ccf9caf4b213c079cffc168f3ad02743132b9d5d50fe0ab927acc65e959f
BLAKE2b-256 checksum
How to use checksums
91314face68440ee5c8c0a1f23d46a81e43a26f603157fee2c748ddce04e7c46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.6

Release files / autochord-0.1.4-py3-none-any.whl

Download URL autochord-0.1.4-py3-none-any.whl
Size 350.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97c0ae92d3ee90083f11b575d707f0f493d8900145719e097b299061c92894a5
BLAKE2b-256 checksum
How to use checksums
dd19bf307cf5d5aeaa44e3fe83e022b0770149ad9fb83dc98f8e9bec888e36ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.6

Security for autochord 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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