Skip to main content

LeadSheet Analyser 🎵

A specialized Python package for leadsheet analysis using chord dissimilarity metrics.

Features

  • 🎼 Chord Processing: Parse both Harte notation (A:min) and shorthand (Am)
  • 📐 Modal Embeddings: Map chords into continuous geometric spaces using musical systems (e.g. Diatonic, Messiaen)
  • 🧮 Optimal Transport: Compute alignment and distance between entire chord progressions
  • 💾 Data Processing: Tools for musical datasets (JAMS format support)
  • 📚 Rich Constants: Comprehensive musical constants and predefined systems

Quick Start

import leadsheetanalyser

# Parse chords (supports multiple formats)
chord = leadsheetanalyser.map_chord("Am")  # Shorthand
chord = leadsheetanalyser.map_chord("A:min")  # Harte notation

# Analyze chord relationships in a musical system
from leadsheetanalyser.chord_dissimilarities import modal_dissimilarity, create_identity_system
c_maj = leadsheetanalyser.chord_name_to_tuple("C:maj")
f_maj = leadsheetanalyser.chord_name_to_tuple("F:maj")
system = create_identity_system()
dissimilarity = modal_dissimilarity(c_maj, f_maj, system, p=1.0)

# Compute Optimal Transport distance between two songs
from leadsheetanalyser.song_distance import song_distance
song1 = [c_maj, f_maj, c_maj]
song2 = [c_maj, leadsheetanalyser.chord_name_to_tuple("G:7"), c_maj]
dist = song_distance(song1, song2, W=system, p=1.0)

Package Structure

leadsheetanalyser/
├── chords.py                # Chord processing and parsing
├── chord_dissimilarities.py # Modal embeddings and chord distances
├── song_distance.py         # Optimal transport between progressions
├── musical_systems.py       # Musical system definitions (W matrix)
├── system_analysis.py       # Comparative analysis and clustering
├── scales.py                # Scale analysis and properties
├── constants.py             # Predefined systems and mappings
└── data_processing.py       # Dataset tools (JAMS)

Installation & Setup

# Install from PyPI
pip install leadsheetanalyser

# Or install from source for development
git clone https://github.com/USERNAME/leadsheetanalyser.git
cd leadsheetanalyser
pip install -e .

# Set up datasets (downloads from GitHub releases - fast & efficient)
python scripts/download_data.py

For complete data setup instructions, see DATA.md.

Testing

# Run all tests
python -m pytest tests/

# Or use the provided script
python tests/run_tests.py

Dependencies

Core dependencies (automatically installed with pip install -e .):

  • numpy, scipy - Scientific computing and clustering
  • pandas - Data manipulation
  • pot - Python Optimal Transport
  • jams - Musical annotation format
  • music21, harte-library - Music and chord processing
  • matplotlib, seaborn - Visualization

Documentation

License

MIT License - see LICENSE for details.

Download files

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

Source Distribution

leadsheetanalyser-0.2.0.tar.gz (39.9 kB view details)

Uploaded Source

Built Distribution

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

leadsheetanalyser-0.2.0-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file leadsheetanalyser-0.2.0.tar.gz.

File metadata

  • Download URL: leadsheetanalyser-0.2.0.tar.gz
  • Upload date:
  • Size: 39.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for leadsheetanalyser-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2dc8d6fd1d929bcd76c0dff4e187aee788fde172e3a2489bfe59234e78c082d1
MD5 d474a1c0ad4d5fcb28ae539bfaea8109
BLAKE2b-256 e1f663f5bee7143c03a352518bd97650340a6df03993c49c31039d14b09266de

See more details on using hashes here.

Provenance

The following attestation bundles were made for leadsheetanalyser-0.2.0.tar.gz:

Publisher: publish.yml on klutchnikoff/leadsheetanalyser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file leadsheetanalyser-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for leadsheetanalyser-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 294ace42f2a9af2891ba7e46b97af860b93f335ce095b67ba2b5a3d1dde9ee4a
MD5 1abec2a62964afe9b7da991fe10835ce
BLAKE2b-256 527dd420c4a57a69d7d29e986a4a27567ee9d4203518ccc7dfaf4e01cde4395f

See more details on using hashes here.

Provenance

The following attestation bundles were made for leadsheetanalyser-0.2.0-py3-none-any.whl:

Publisher: publish.yml on klutchnikoff/leadsheetanalyser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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