Class VoiceLeadingSolver
- Namespace
- Celeritas.Core.VoiceLeading
- Assembly
- Celeritas.dll
High-performance voice leading solver using parallel BFS/A* search. Finds optimal voicings for a chord progression following counterpoint rules.
Algorithm:
- Generate all valid voicings for each chord (constraint: notes in range, proper spacing)
- Build a graph where edges connect compatible voicings of consecutive chords
- Use parallel A* search to find the path with minimum voice leading cost
The rules followed are exactly the ones VoiceLeadingViolation names. Inversion is not among them: a chord arrives here as a set of pitch classes with no bass named, so the bass takes whichever chord tone the smoothest path wants, and a progression may well begin or end on a six-four. Choose the inversions yourself if they matter.
public sealed class VoiceLeadingSolver
- Inheritance
-
VoiceLeadingSolver
- Inherited Members
Constructors
VoiceLeadingSolver(VoiceLeadingSolverOptions?)
High-performance voice leading solver using parallel BFS/A* search. Finds optimal voicings for a chord progression following counterpoint rules.
Algorithm:
- Generate all valid voicings for each chord (constraint: notes in range, proper spacing)
- Build a graph where edges connect compatible voicings of consecutive chords
- Use parallel A* search to find the path with minimum voice leading cost
The rules followed are exactly the ones VoiceLeadingViolation names. Inversion is not among them: a chord arrives here as a set of pitch classes with no bass named, so the bass takes whichever chord tone the smoothest path wants, and a progression may well begin or end on a six-four. Choose the inversions yourself if they matter.
public VoiceLeadingSolver(VoiceLeadingSolverOptions? options = null)
Parameters
optionsVoiceLeadingSolverOptionsSolver options; defaults to
VoiceLeadingSolverOptions.Defaultwhen null.
Methods
Solve(IReadOnlyList<int[]>, int)
Solve voice leading for a progression of chords. Returns optimal SATB voicings for each chord.
public VoiceLeadingSolution Solve(IReadOnlyList<int[]> chordPitchClasses, int keyRoot = 0)
Parameters
chordPitchClassesIReadOnlyList<int[]>One pitch-class set per chord.
keyRootintPitch class of the tonic, 0=C .. 11=B. Folded into that range, as Check(Voicing, Voicing, int) folds its own, so -1 is B and 12 is C. It was handed to the rules unfolded, and a root of -12 or below — a tonic an octave down — indexed an array by a negative number inside the parallel search and came back as an AggregateException naming no argument.
Returns
Exceptions
- ArgumentNullException
chordPitchClassesis null.
SolveFromSymbols(IReadOnlyList<string>, int)
Solve voice leading from chord symbols.
public VoiceLeadingSolution SolveFromSymbols(IReadOnlyList<string> chordSymbols, int keyRoot = 0)
Parameters
chordSymbolsIReadOnlyList<string>keyRootint
Returns
Exceptions
- ArgumentNullException
chordSymbolsis null.