music-interval
Simple and fast musical interval library:
var interval = interval // => '2M'interval // => '6m'
Install
Use npm: npm i --save music-interval
and require it:
var interval =
For browser use browserify or webpack.
API
-
invert
-
Get the inversion of an interval. The inversion of an interval is always a simple interval
Example
invert('3M') // => '6m'
-
semitones
-
Get the semitones of a interval
- Source:
Example
semitones('5P') // => 7 semitones('-5P') // => -7
-
simplify
-
Simplify an interval
Example
simplify('9M') // => '2M' simplify('-9M') // => '-2M'
-
type
-
Get the type of an interval (
'P'
for perfetable and'M'
for majorable)It does NOT return the quality of the interval (@see interval/quality)
Example
type('4P') // => 'P' type('5A') // => 'P' type('3m') // => 'M' type('2d') // => 'M'
generated with docme
License
MIT License