API Reference
tonal_py exposes 23 namespaces, each mirroring a @tonaljs/* package. All
function names use Python snake_case (the JS docs use camelCase — see
Naming Conventions for the mapping).
Foundation layer
The lowest-level music-theory primitives. Most users never touch these
directly.
| Namespace |
What it does |
| Core |
Re-exports of the foundation layer + a deprecate helper |
| Pcset |
Pitch class set utilities (chroma, modes, subset/superset) |
Notes and intervals
| Namespace |
What it does |
| Note |
Parse, transpose, simplify, enharmonic-spell notes |
| Interval |
Parse and arithmetic on intervals |
| Midi |
MIDI ↔ note name ↔ frequency conversions |
Chords and scales
| Namespace |
What it does |
| Chord |
Parse chord names ("Cmaj7", "F#dim/A"), get notes, detect from notes |
| ChordType |
The 106-entry chord-type dictionary |
| Scale |
Build scales from a tonic + type, detect, find modes |
| ScaleType |
The 92-entry scale-type dictionary |
| Key |
Major/minor key with diatonic chords + harmonic functions |
| Mode |
The 7 diatonic modes with triads and seventh chords |
| RomanNumeral |
Roman numeral analysis (I, IV, V7, bVII...) |
Voicings and rhythm
Notation and utilities
| Namespace |
What it does |
| AbcNotation |
ABC notation ↔ scientific notation |
| Range |
MIDI / chromatic ranges between waypoint notes |
| Progression |
Convert chord progressions ↔ roman numerals |
| Collection |
Generic array helpers (range, rotate, shuffle, permutations) |