Tonalis — a generic, format-agnostic music-harmony DSL (parse/lint/AST/JSON/text).
Project description
tonalis
A generic, format-agnostic music-harmony DSL for lead sheets: parse chord
charts to a canonical AST, lint them with structured findings, and render back
to canonical text or JSON. This is the Python reference implementation;
TypeScript (tonalis on npm) and Rust (tonalis on crates.io) ports conform
to the same normative spec and a shared 255-case conformance suite.
Music-theory questions (chord validity, scales, keys) are delegated to the
pure tonalis-music-dsl theory library.
Install
pip install tonalis
Use
from tonalis import parse_dsl, lint, serialize, to_json
result = parse_dsl(open("chart.txt").read())
findings = list(result.findings) + (lint(result.chart) if result.chart else [])
chart = result.chart # a LeadSheet AST
json_obj = to_json(chart) # canonical JSON (a dict)
text = serialize(chart) # canonical text rendering
A small CLI is included: python -m tonalis chart.txt prints lint findings
(exit 1 if any error).
Links
- Source, spec, docs, and conformance suite: https://github.com/drycode/tonalis
- License: MIT
Project details
Release history Release notifications | RSS feed
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 tonalis-0.1.0.tar.gz.
File metadata
- Download URL: tonalis-0.1.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43c9b45b38bca6b6fbc6f5689242dbe36cfbd1f11b825532792ce36153949869
|
|
| MD5 |
e46a1028aa03f4aad374ae93d3529a00
|
|
| BLAKE2b-256 |
79959fc4f0f2f894b5f72fadb0f9566c9451fe3edf8c2e112a8ff69d63bfe392
|
File details
Details for the file tonalis-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tonalis-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b407e96706438184e2d362475a012813909075ebeef2279dc4df5e2478ae7cf9
|
|
| MD5 |
565686bb9e46655839ff96aa860ac23a
|
|
| BLAKE2b-256 |
0073b227144a4545e614c79dece916d907277a5273804a9327841567b128d667
|