Getting started
tonal
is a music theory library. Contains functions to manipulate tonal
elements of music (note, intervals, chords, scales, modes, keys). It deals with
abstractions (not actual music or sound).
tonal
is implemented in Typescript and published as a collection of Javascript
npm packages.
It uses a functional programing style: all functions are pure, there is no data mutation, and entities are represented by data structures instead of objects.
Example
Install
Install all packages at once:
You can read CHANGELOG here.
Usage
Tonal is compatible with both ES5 and ES6 modules, and browser.
ES6 import
:
ES5 require
:
Browser
You can use the browser version from jsdelivr CDN directly in your html:
Or if you prefer, grab the minified browser ready version from the repository.
Bundle size
tonal
includes all published modules.
Although the final bundle it is small, you can reduce bundle sizes even more by installing the modules individually, and importing only the functions you need.
Note that individual modules are prefixed with @tonaljs/
. For example: