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 clusteringpandas- Data manipulationpot- Python Optimal Transportjams- Musical annotation formatmusic21,harte-library- Music and chord processingmatplotlib,seaborn- Visualization
Documentation
- DATA.md - Complete data setup and management guide
- ORGANIZATION.md - Package architecture and API reference
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50ce54966abf041d804354df8c8f5ceb0ffb3ce40c20ace79663dc62b0dfb1c0
|
|
| MD5 |
27d95f46b9ae7a96c64090b6137de163
|
|
| BLAKE2b-256 |
ccd19d3343bd276153131c8b58e3f5c59bf41d3710c1f7222dfcaea554b9b348
|
Provenance
The following attestation bundles were made for leadsheetanalyser-0.1.0.tar.gz:
Publisher:
publish.yml on klutchnikoff/leadsheetanalyser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
leadsheetanalyser-0.1.0.tar.gz -
Subject digest:
50ce54966abf041d804354df8c8f5ceb0ffb3ce40c20ace79663dc62b0dfb1c0 - Sigstore transparency entry: 2217762223
- Sigstore integration time:
-
Permalink:
klutchnikoff/leadsheetanalyser@1c6ed0eca171dc75d3b22ea6acd21280e540aee5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/klutchnikoff
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1c6ed0eca171dc75d3b22ea6acd21280e540aee5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file leadsheetanalyser-0.1.0-py3-none-any.whl.
File metadata
- Download URL: leadsheetanalyser-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e54f49dd6adf9504b371126236153fb4041cfcc1c50f20d0e87b6615c3c08593
|
|
| MD5 |
67e5e7faebc2791d994db9e30255d225
|
|
| BLAKE2b-256 |
b2b1a3c6e8e104004384179517ae0d804d5d934ed1a227a9abf9bf6273021db8
|
Provenance
The following attestation bundles were made for leadsheetanalyser-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on klutchnikoff/leadsheetanalyser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
leadsheetanalyser-0.1.0-py3-none-any.whl -
Subject digest:
e54f49dd6adf9504b371126236153fb4041cfcc1c50f20d0e87b6615c3c08593 - Sigstore transparency entry: 2217762852
- Sigstore integration time:
-
Permalink:
klutchnikoff/leadsheetanalyser@1c6ed0eca171dc75d3b22ea6acd21280e540aee5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/klutchnikoff
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1c6ed0eca171dc75d3b22ea6acd21280e540aee5 -
Trigger Event:
push
-
Statement type: