Package Exports
- @tonaljs/interval
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tonaljs/interval) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@tonaljs/interval

A collection of functions to create and manipulate music intervals
API
names() => string[]
Return a list of (natural) interval names:
names(); // => ["1P", "2M", "3M", "4P", "5P", "6m", "7m"]fromSemitones(semitones: number) => string
Given a number of semitones, returns the interval name:
fromSemitones(7); // => "5P"
fromSemitones(-7); // => "-5P"simplify(interval: string) => string
Simplify an interval:
simplify("9M"); // => "2M"
["8P", "9M", "10M", "11P", "12P", "13M", "14M", "15P"].map(simplify);
// => [ "8P", "2M", "3M", "4P", "5P", "6M", "7M", "8P" ]
simplify("2M"); // => "2M"
simplify("-2M"); // => "7m"invert(interval: string) => string
Get the interval inversion:
invert("3m"); // => "6M"
invert("2M"); // => "7m"add(a: string, b: string) => string
Add two intervals:
add("3m", "5P"); // => "7m"substract(min: string, sub: string) => string
Substract two intervals:
substract("5P", "3M"); // => '3m'
substract("3M", "5P"); // => '-3m'