moment-of-symmetry
Version:
Moment of Symmetry (MOS) musical scale generation and analysis for Javascript
67 lines (66 loc) • 2.25 kB
TypeScript
/**
* Valid nominals for absolute pitches in [Diamond mos notation](https://en.xen.wiki/w/Diamond-mos_notation).
*/
export type DiamondMosAlphabet = 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';
/**
* Count of L steps followed by count of s steps.
*/
export type MosMonzo = [number, number];
/**
* 0-indexed degree of [Diamond mos notation](https://en.xen.wiki/w/Diamond-mos_notation).
*/
export type DiamondMosDegree = {
/**
* Center of this degree. A perfect or a neutral interval.
*/
center: MosMonzo;
/**
* Quality of this degree. Imperfect has a neutral center and must be further processed to obtain the minor and major variants.
*/
perfect: boolean;
/**
* The neutral interval for perfect intervals where it makes sense.
*/
mid?: MosMonzo;
};
/**
* [Diamond mos notation](https://en.xen.wiki/w/Diamond-mos_notation) configuration.
*/
export type DiamondMosNotation = {
/**
* Counts of [L, s] steps for every available nominal with J at unison. Add equaves to reach other octaves.
*/
scale: Map<string, MosMonzo>;
/**
* Interval of equivalence / octave.
*/
equave: MosMonzo;
/**
* 0-indexed degree of the scale for one period. Add periods to reach further.
*/
degrees: DiamondMosDegree[];
/**
* Interval of repetition.
*/
period: MosMonzo;
/**
* Bright generator of the scale.
*/
brightGenerator: MosMonzo;
};
/** Single characters of valid nominals. */
export declare const DIAMOND_MOS_ALPHABET: DiamondMosAlphabet[];
/**
* Obtain the 0-indexed nth generalized Diamond-mos nominal.
* @param n Index of the nominal.
* @returns A single character from J through Z or a multi-character string like 'JJ' starting from n = 17.
*/
export declare function nthNominal(n: number): string;
/**
* Generate configuration for [Diamond mos notation](https://en.xen.wiki/w/Diamond-mos_notation).
*
* Always based on J and 0-indexed even if scale is diatonic.
* @param mode Mode of a MOS scale such as 'LLsLLLs'.
* @returns Configuration for notation software.
*/
export declare function generateNotation(mode: string): DiamondMosNotation;