note-interval

1.0.3 • Public • Published

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

Package Sidebar

Install

npm i note-interval

Weekly Downloads

8

Version

1.0.3

License

MIT

Last publish

Collaborators

  • danigb