Realize a single chord as an explicit tertian voicing in a chosen style,
independent of the SATB range search used by voiceChord.
The chord tones are stacked in close position from the bass (bassPc, else
rootPc) in the given scientific-pitch octave upward (octave 4 starts the
bass near C4 = MIDI 60, matching midiToNote and the bass module).
When topNote is given the stack is rotated so the highest voice's pitch
class equals that note (or the nearest chord tone). The chosen
VoicingStyle then transforms the stack, and the result is returned as
ascending MIDI pitches (index 0 = lowest).
A drop voicing lowers one voice below the rest, so that voice is its bass —
which is what tells the drop-2 voicings of one chord apart. When the chord
names a bass tone of its own, the close stack is therefore rotated so the
style drops that tone, and the result is the drop voicing whose bass is the
tone asked for; the named bass is not lowered under an already dropped voice
afterwards, which would leave a hole wider than an octave in the middle. A
bass the chord does not contain is no voice of the stack and cannot be the
dropped one, so it keeps the bottom and the drop happens above it.
Every returned pitch is a valid MIDI number: an octave whose stack would run
off either end of the 0..127 range is rejected rather than voiced out of
range, matching nextVoicing, which clamps its derived ranges.
Realize a single chord as an explicit tertian voicing in a chosen style, independent of the SATB range search used by voiceChord.
The chord tones are stacked in close position from the bass (
bassPc, elserootPc) in the given scientific-pitchoctaveupward (octave 4 starts the bass near C4 = MIDI 60, matching midiToNote and the bass module). WhentopNoteis given the stack is rotated so the highest voice's pitch class equals that note (or the nearest chord tone). The chosen VoicingStyle then transforms the stack, and the result is returned as ascending MIDI pitches (index 0 = lowest).A drop voicing lowers one voice below the rest, so that voice is its bass — which is what tells the drop-2 voicings of one chord apart. When the chord names a bass tone of its own, the close stack is therefore rotated so the style drops that tone, and the result is the drop voicing whose bass is the tone asked for; the named bass is not lowered under an already dropped voice afterwards, which would leave a hole wider than an octave in the middle. A bass the chord does not contain is no voice of the stack and cannot be the dropped one, so it keeps the bottom and the drop happens above it.
Every returned pitch is a valid MIDI number: an octave whose stack would run off either end of the 0..127 range is rejected rather than voiced out of range, matching nextVoicing, which clamps its derived ranges.