Tonal
Functional music-theory library for notes, intervals, chords, scales and keys in JavaScript.
| Language | JavaScript |
|---|---|
| Category | Composition & notation |
| License | MIT |
| Platforms | macOS Windows Linux Web |
| Install | npm install tonal |
| First released | 2015 |
| Maintained | Yes |
| Links | Website · Source |
Strengths
- Pure, immutable functions covering a very broad music-theory surface
- Tree-shakeable modular @tonaljs/* packages, TypeScript-typed
- Actively maintained
Limitations
- Theory/data only: produces no sound or MIDI on its own
- Large API surface can be overwhelming for beginners
Best for
Computing notes, scales, chords and key relationships inside any JS app.
Minimal example
import { Note, Scale } from "tonal";
Note.midi("C4"); // 60
Scale.get("C major").notes; // ["C","D","E","F","G","A","B"]