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. Pythagorean, 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.1.0.tar.gz (40.0 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.1.0-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for leadsheetanalyser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 50ce54966abf041d804354df8c8f5ceb0ffb3ce40c20ace79663dc62b0dfb1c0
MD5 27d95f46b9ae7a96c64090b6137de163
BLAKE2b-256 ccd19d3343bd276153131c8b58e3f5c59bf41d3710c1f7222dfcaea554b9b348

See more details on using hashes here.

Provenance

The following attestation bundles were made for leadsheetanalyser-0.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for leadsheetanalyser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e54f49dd6adf9504b371126236153fb4041cfcc1c50f20d0e87b6615c3c08593
MD5 67e5e7faebc2791d994db9e30255d225
BLAKE2b-256 b2b1a3c6e8e104004384179517ae0d804d5d934ed1a227a9abf9bf6273021db8

See more details on using hashes here.

Provenance

The following attestation bundles were made for leadsheetanalyser-0.1.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