interval-class
Get the interval class of an interval:
The interval class is the shortest distance in pitch class space between two unordered pitch classes
In practice, an interval class is an integer between 0 and 6:
var ic = // => 5 // => 5
Install it via npm: npm i --save interval-class
This tiny function is part of tonal
Usage
Work with intervals in shorthand notation:
'1P' '2M' '3M' '4P' '5P' '6M' '7M'// => [ 0, 2, 4, 5, 5, 3, 1, 0 ]
You can pass the interval in semitones:
// => 5 (a perfect fifth)
Or using array notation:
// => 2 (a major second)
License
MIT License