The lead line to write against, in ascending onset order.
OptionaltimelineThe harmony to write against. A timeline carries its own segment
boundaries, so a chord change anywhere — including off the generator's
half-beat probe grid — is seen; prefer it over chordAt.
Exactly one of timeline and chordAt is required; timeline wins when
both are given.
OptionalchordChord sounding at an absolute beat position, or null when none applies.
A callback is opaque: the generator cannot see where it changes, so it
probes a half-beat grid and otherwise relies on chordChangeBeats. A held
counter note that spans an unseen change is not checked against the new
chord.
OptionalchordExact chord-change beats the chordAt callback does not expose. Ignored
when timeline is given, since a timeline lists its own boundaries.
Key/scale context for scale-tone decisions. A key name such as 'C major'
is read as that key.
OptionaltsMeter used for strong-beat decisions, in any form that names one.
OptionalregisterWhich side of the melody the counter line occupies.
OptionalrhythmOnset strategy: 'complement' moves where the melody holds or rests and
reinforces some strong beats; 'follow' mirrors melody onsets.
OptionalprofileStyle profile applied to candidate pitches. It sets what is rejected
outright and, through PROFILE_WEIGHTS, what is preferred among the
candidates that remain: 'strict' seeks contrary motion and avoids
similar, 'pop' treats a run of parallel thirds or sixths as the harmony
line an arranger would write.
OptionalweightsPer-field overrides of the profile's ranking weights, for a preference the two stock profiles do not express — a line that should leap more freely, or one that should hold a pedal wherever it can. Every field named must be a finite number.
OptionalpitchLowest MIDI pitch the counter line may use (default derived from register).
OptionalpitchHighest MIDI pitch the counter line may use (default derived from register).
OptionalctxThe generation context, so the counter line is drawn from the same project source as every other part and no two parts collide.
Its seed places the 'complement' onsets and breaks ties between equally
good candidate pitches; the same seed always yields the same line. Where the
constraints leave only one good answer — which is common with
rhythm: 'follow', whose onsets are fixed by the melody — changing the seed
changes nothing.
Options controlling generateCounterMelody.