@tonaljs/range
Version:
Create (musical) note ranges
39 lines (36 loc) • 1.52 kB
text/typescript
import { ToNoteNameOptions } from '@tonaljs/midi';
/**
* Create a numeric range. You supply a list of notes or numbers and it will
* be connected to create complex ranges.
*
* @param {Array} notes - the list of notes or midi numbers used
* @return {Array} an array of numbers or empty array if not valid parameters
*
* @example
* numeric(["C5", "C4"]) // => [ 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60 ]
* // it works midi notes
* numeric([10, 5]) // => [ 10, 9, 8, 7, 6, 5 ]
* // complex range
* numeric(["C4", "E4", "Bb3"]) // => [60, 61, 62, 63, 64, 63, 62, 61, 60, 59, 58]
*/
declare function numeric(notes: (string | number)[]): number[];
/**
* Create a range of chromatic notes. The altered notes will use flats.
*
* @function
* @param {Array} notes - the list of notes or midi note numbers to create a range from
* @param {Object} options - The same as `midiToNoteName` (`{ sharps: boolean, pitchClass: boolean }`)
* @return {Array} an array of note names
*
* @example
* Range.chromatic(["C2, "E2", "D2"]) // => ["C2", "Db2", "D2", "Eb2", "E2", "Eb2", "D2"]
* // with sharps
* Range.chromatic(["C2", "C3"], { sharps: true }) // => [ "C2", "C#2", "D2", "D#2", "E2", "F2", "F#2", "G2", "G#2", "A2", "A#2", "B2", "C3" ]
*/
declare function chromatic(notes: (string | number)[], options?: ToNoteNameOptions): string[];
/** @deprecated */
declare const _default: {
numeric: typeof numeric;
chromatic: typeof chromatic;
};
export { chromatic, _default as default, numeric };