1.0.3 • Published 9 years ago

note-interval v1.0.3

Weekly downloads
8
License
MIT
Repository
github
Last release
9 years ago

note-interval npm version

tonal

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