moment-of-symmetry
Version:
Moment of Symmetry (MOS) musical scale generation and analysis for Javascript
25 lines (24 loc) • 1.01 kB
TypeScript
/**
* Distribute subsequences as evenly as possible using Björklund's algorithm;
* modified as to always return the brightest mode.
*/
export declare function bjorklund<T>(a: number, b: number, first: T, second: T): T[];
/**
* Using this function so that we don't have to replace `first' and `second`
* with `true` and `false` every time the algorithm does an array comparison.
*/
export declare function bjorklundStr(a: number, b: number): string;
export declare function bresenham<T>(a: number, b: number, first: T, second: T): T[];
/**
* Cumulative sum of input array.
* @param array Array of steps.
* @returns Scale of accumulated steps.
*/
export declare function cumsum(array: number[]): number[];
/**
* Find the bright generator for a MOS pattern.
* @param l Number of large steps.
* @param s Number of small steps.
* @returns [generator's number of large steps, generator's number of small steps]
*/
export declare function mosGeneratorMonzo(l: number, s: number): [number, number];