fretboard-api
Version:
A kind of API for fretboard diagrams
94 lines (93 loc) • 2.63 kB
TypeScript
import { ShapeIntervals, ShapeNotes, ShapeType } from "./shape";
/**
* [ 'E2', 'A2', 'D3', 'G3', 'B3', 'E4' ] --> [ '1P', '4P', '4P', '4P', '3M', '4P' ]
*
* @param tuning
* @returns {ReadonlyArray<any>}
*/
declare function computeTuningIntervals(tuning?: string[]): string[];
/**
* [ 'E2', 'A2', 'D3', 'G3', 'B3', 'E4' ] --> [ 'E', 'A', 'D', 'G', 'B', 'E' ]
*
* @param tuning
* @returns {ReadonlyArray<any>}
*/
declare function computeTuningPitchClasses(tuning?: string[]): ReadonlyArray<string | null>;
/**
*
* @param fromString
* @param fromFret
* @param toString
* @param toFret
* @param tuning
*/
declare function semitones(fromString: number, fromFret: number, toString: number, toFret: number, tuning?: string[]): number;
/**
*
* @param fromString
* @param fromFret
* @param toString
* @param toFret
* @param tuning
*/
declare function interval(fromString: number, fromFret: number, toString: number, toFret: number, tuning?: string[]): string;
/**
*
* @param shape
* @param tuning
*
* @example
*
* Fretboard.intervals(Shape.create("022100"));
*
* s { frets: [ [ 0 ], [ 2 ], [ 2 ], [ 1 ], [ 0 ], [ 0 ] ],
* root: { string: 0, fret: 0 } }
*
* intervals [ [ '1P' ], [ '5P' ], [ '8P' ], [ '10M' ], [ '12P' ], [ '15P' ] ]
*/
declare function intervals(shape: ShapeType, tuning?: string[]): ShapeIntervals;
/**
*
* @param shape
* @param tuning
*/
declare function notes(shape: ShapeType, tuning?: string[]): ShapeNotes;
/**
* Find a position
*
* Syntaxe 1: fret(note, string)
* Syntaxe 2: fret(fromString, fromFret, toString, toFret, minFret, maxFret)
* @returns {*}
*/
/**
* shape is not changed; intervals may change depending on the tuning.
* @param shape
* @param fret
* @returns {*}
*/
declare function moveToFret(shape: ShapeType, fret: number): ShapeType;
/**
* shape is not changed; intervals may change depending on the tuning.
* @param shape
* @param string
* @returns {*}
*/
/**
* Play this shape at this position with this tuning
*
* @param shape Object
* @param tuning Array
* @param position int
*/
declare function play(shape: ShapeType, position?: number | null, tuning?: string[]): ShapeType;
export declare const Fretboard: {
computeTuningIntervals: typeof computeTuningIntervals;
computeTuningPitchClasses: typeof computeTuningPitchClasses;
semitones: typeof semitones;
intervals: typeof intervals;
interval: typeof interval;
notes: typeof notes;
moveToFret: typeof moveToFret;
play: typeof play;
};
export {};