@tonaljs/chord-type
Version:
A dictionary of musical chords
64 lines (61 loc) • 1.75 kB
TypeScript
import { Pcset, PcsetChroma, PcsetNum } from '@tonaljs/pcset';
type ChordQuality = "Major" | "Minor" | "Augmented" | "Diminished" | "Unknown";
interface ChordType extends Pcset {
name: string;
quality: ChordQuality;
aliases: string[];
}
type ChordTypeName = string | PcsetChroma | PcsetNum;
/**
* Given a chord name or chroma, return the chord properties
* @param {string} source - chord name or pitch class set chroma
* @example
* import { get } from 'tonaljs/chord-type'
* get('major') // => { name: 'major', ... }
*/
declare function get(type: ChordTypeName): ChordType;
/** @deprecated */
declare const chordType: typeof get;
/**
* Get all chord (long) names
*/
declare function names(): string[];
/**
* Get all chord symbols
*/
declare function symbols(): string[];
/**
* Keys used to reference chord types
*/
declare function keys(): string[];
/**
* Return a list of all chord types
*/
declare function all(): ChordType[];
/** @deprecated */
declare const entries: typeof all;
/**
* Clear the dictionary
*/
declare function removeAll(): void;
/**
* Add a chord to the dictionary.
* @param intervals
* @param aliases
* @param [fullName]
*/
declare function add(intervals: string[], aliases: string[], fullName?: string): void;
declare function addAlias(chord: ChordType, alias: string): void;
/** @deprecated */
declare const _default: {
names: typeof names;
symbols: typeof symbols;
get: typeof get;
all: typeof all;
add: typeof add;
removeAll: typeof removeAll;
keys: typeof keys;
entries: typeof all;
chordType: typeof get;
};
export { type ChordQuality, type ChordType, add, addAlias, all, chordType, _default as default, entries, get, keys, names, removeAll, symbols };