note-interval
v1.0.3
Published
Get the interval between two notes
Downloads
23
Maintainers
Readme
note-interval
note-interval
is a function to calculate the interval between two notes:
var interval = require('note-interval')
interval('C3', 'E4') // => '3M'
Install
Only via npm: npm i --save note-interval
Usage
There's only one function with two params. The function can be partially applied:
var fromC = interval('C4')
fromC('Eb3') // => '3m'
Get interval between two notes (pitches)
This is the simplest use case. Can be descending intervals:
interval('C3', 'F3') // => '4P'
interval('C3', 'F2') // => '-5P'
Get interval between two pitch classes
If one or both notes are pitch classes (no octave) an ascending interval is always returned:
interval('C', 'F') // => '4P'
interval('B', 'C') // => '2m'
Distance between intervals
It can be used to subtract intervals:
interval('3M', '5P') // => '3m'
License
MIT License