import { HarmonizedChord } from '../chord/harmonized-chord'; import { IncompleteChord } from '../chord/incomplete-chord'; import { ProgressionRule } from './progression'; import { RomanNumeral } from './roman-numeral'; import { Scale } from '../scale'; import { ExpansionRule } from './expansion'; import { Interval } from '../interval/interval'; import { NestedIterable, NestedLazyMultiIterable } from '../util/nested-iterable'; import { SubstitutionRule } from './substitution'; declare class HarmonizerContext { private cache; getOrSet(position: number, terminal: RomanNumeral, generator: () => NestedLazyMultiIterable): NestedLazyMultiIterable; } /** * The parameters that the harmonizer uses */ export interface HarmonizerParameters { /** * The chords that are enabled if using progressions */ enabledProgressions?: ProgressionRule[]; /** * The expansions that are enabled if using progressions */ enabledExpansions?: ExpansionRule[]; /** * The substitutions that are enabled if using progressions */ enabledSubstitutions?: SubstitutionRule[]; /** * Whether to check against the internal progressions or use as-is * Requires complete roman numerals * Will still prefer using sequences from internal progressions */ useProgressions?: boolean; /** * Whether or not to modulate * Defaults to falsy */ canModulate?: boolean; /** * If enabled, the key areas that are allowed to modulate to * E.g. P5 in C major would allow to go to G major and back */ modulationsAllowed?: Interval[]; /** * Whether a cadence needs to happen in a key before the next modulation * Helps to reduce the search space */ /** * Force the harmonizer to explore a certain number of children fully through at each level * Results in exponential time complexity */ /** * Force the harmonizer to explore a certain number of top-level options */ /** * Whether to run the checks beforehand to see if the constraints are possible to satisfy * false is the 'old' behavior resulting in exponential backtracking for failure */ /** * Disables caching within one harmonization */ disableCaching?: boolean; } export type CompleteHarmonyGenerator = NestedIterable; /** * Class that yields harmonies for a given set of constraints */ export declare class Harmonizer { params: HarmonizerParameters; constructor(params: HarmonizerParameters); /** * Find the next possible chord to progress to (with modulations and expansions between) without looking at the constraints * @param params the params to generate harmony using * @param previous the previous chords */ nextHarmony(constraints: IncompleteChord[], position: number, previous: RomanNumeral): Generator<[harmony: RomanNumeral[], next: RomanNumeral], void>; /** * Find the next possible chord to progress to (with modulations and expansions between) checking that constraints can be satisfied * @param params the params to generate harmony using * @param previous the previous chords */ matchingHarmony(constraints: IncompleteChord[], position: number, previous: RomanNumeral): Generator<[reconciled: HarmonizedChord[], next: RomanNumeral]>; private checkCache; /** * Finds the next possible complete harmonization of the constraints (with using the previous chords) * @param params the params to harmonize using * @param constraints the constraints to match against * @param previous the chords before this one */ matchingCompleteHarmonyWithContext(constraints: IncompleteChord[], position: number, previous: RomanNumeral, context?: HarmonizerContext): CompleteHarmonyGenerator; /** * Finds the next possible complete harmonization of the constraints * @param params the params to harmonize using */ matchingCompleteHarmony(constraints: IncompleteChord[], scale: Scale): CompleteHarmonyGenerator; } export {};