import { PartWritingParameters } from './part-writing'; import { Harmonizer } from '../harmony/harmonizer'; import { IncompleteChord } from '../chord/incomplete-chord'; import { Scale } from '../scale'; import { NestedIterable, NestedLazyMultiIterable } from '../util/nested-iterable'; import { CompleteChord } from '../chord/complete-chord'; import { HarmonizedChord } from '../chord/harmonized-chord'; export declare function nestedMinGenerator(iterable: Iterable, mapper: (value: T) => number[], innerMapper: (value: T) => number[]): Generator; /** * Used to tell the PartWriter how to process the results it finds */ export interface PartWriterParameters { /** * Whether to check whether a voicing is possible between every pair of contiguous chords before / during searching * Increases runtime, but exponential time might result from an invalid progression without this */ /** * Gives the ability to modify the order in which results are yielded * Allows for a variety of functionality like: greedy, local best, deep best */ yieldOrdering: (iterator: NestedIterable, previous: CompleteChord[], partWriter: PartWriter) => NestedIterable; } /** * Holds the predefined yieldOrdering */ export declare namespace PartWriterParameters { /** * Simply returns the provided iterator as is, resulting in the first option found at each level * @param iterator the nested iterator */ const greedyOrdering: PartWriterParameters['yieldOrdering']; /** * Returns the items in the iterator ranked by the PartWriting.Preferences * @param iterator the nested iterator * @param previous the previous chords in the harmonization for this context * @param partWriter the part writing instance */ const defaultOrdering: PartWriterParameters['yieldOrdering']; const depthOrdering: PartWriterParameters['yieldOrdering']; } /** * Class that writes parts, given parameters and constraints */ export declare class PartWriter { partWriterParams: PartWriterParameters; partWritingParams: PartWritingParameters; harmonizer: Harmonizer; /** * Create a new instance using the following parameters * @param partWriterParams the parameters to use for generating results in this class * @param partWritingParams the parameters for shaping and part-writing the results generated * @param harmonizer the harmonizer to use */ constructor(partWriterParams?: PartWriterParameters, partWritingParams?: PartWritingParameters, harmonizer?: Harmonizer); /** * Voices the given constraints completely * @param constraints the constraints to voice for * @param scale the scale to begin in */ voiceAll(constraints: IncompleteChord[], scale: Scale): NestedIterable; /** * Yields all possible voicings at the current level in consideration to the previous * Makes no guarantee that all yielded results will be complete, consider wrapping with resultsOfLength if that is needed */ voiceWithContext(constraints: IncompleteChord[], progression: NestedLazyMultiIterable, previous?: CompleteChord[]): NestedIterable; /** * Generates all valid voicings of a set of chords * @param reconciledConstraints the chords to generate the voicings for * @param previous the previous chords to consider as context */ chordVoicings(reconciledConstraints: HarmonizedChord[], previous?: CompleteChord[]): NestedIterable; /** * Generates all valid voicings of a chord * @param reconciledConstraint the chord to come up with voicings for * @param previous the previous chords to consider as context */ chordVoicing(reconciledConstraint: HarmonizedChord, previous?: CompleteChord[]): Generator; expansionIsVoiceable(current: HarmonizedChord[], previousExpansions: HarmonizedChord[][]): boolean; harmonyIsVoicable(current: HarmonizedChord, previous: HarmonizedChord[]): boolean; }