Sharp11 Interval Module
October 12, 2017 ยท View on GitHub
require('sharp11').interval
Contains an Interval object, which can be created with interval.create() or interval.parse(). Methods of the Interval object do not mutate it, they return a new object.
Exported Functions
create .create(number, quality)
Returns an Interval object given a number (1-13) and a quality, e.g. "M" or "maj".
parse .parse(str)
Returns an Interval object given a string representing that interval, e.g. "P5".
isPerfect .isPerfect(num)
Returns true if a given number represents that of a perfect interval (1, 4, 5, 8, 11, 12).
Interval Object
The Interval object represents an interval between two notes up to a thirteenth. These objects are used quite often internally, but rarely need to be created directly, since every Sharp11 function that takes an interval can be passed a string instead. If necessary, Interval objects can be created using .create() or .parse(). The Interval constructor is also accessible directly as .Interval.
number .number
The number of the interval, e.g., 5.
quality .quality
The quality of the interval, e.g., "P".
name .name
The name of the interval, e.g., "P5".
fullName .fullName
The full name of the interval, e.g., "Perfect Fifth".
invert .invert()
Returns the equivalent interval in the opposite direction, e.g., m3 -> M6.
halfSteps .halfSteps()
Returns the number of half steps in the interval, e.g., P5 -> 7.