@libraz/libcantus - v1.1.0
    Preparing search index...

    Type Alias HarmonizeResult

    The chosen transpose, key, chord path, and per-note roles.

    type HarmonizeResult = {
        transposeSemitones: number;
        key: ResolvedKey;
        chords: ChordSpan[];
        melodyRoles: { noteIndex: number; role: HarmonyRole }[];
    }
    Index
    transposeSemitones: number

    How far the melody was moved, in semitones. Transposing the melody by this much puts it in key, which is the key the chords are in.

    The key the chords are in, whole.

    A key/scale alone says nothing about how it is written, so a result carrying one would report whichever spelling its pitch classes read best from, and an Ab minor handed in would come back out a G# minor. It matters most under key: 'infer', where this is the only account of which key was chosen and a caller has nothing else to spell the chord spans from.

    chords: ChordSpan[]

    One span per chord change, each starting on a harmonic-rhythm boundary.

    melodyRoles: { noteIndex: number; role: HarmonyRole }[]

    Each melody note's role in the chord sounding under it, once chosen.