The penultimate chord, as a chord symbol, chord data, or a
Chord.
The final chord, in any of the same forms.
The prevailing key, as a key name, a key/scale, or a Key.
Voice-leading detail, the chord before from, and whether to
collect the rejected readings; see DetectCadenceOptions.
The cadence, its strength, and the facts behind them.
import { detectCadence, makeChord, majorKey } from '@libraz/libcantus';
detectCadence(makeChord(7, 'maj'), makeChord(0, 'maj'), majorKey(0));
// { type: 'authentic', strength: null, rootPosition: true, evaded: false, ... }
detectCadence(makeChord(7, 'maj'), makeChord(0, 'maj'), majorKey(0), {
voicing: [[55, 62, 71], [48, 64, 72]],
});
// { type: 'authentic', strength: 'perfect', soprano: 'root', ... }
const sixFour = detectCadence(makeChord(7, 'maj'), makeChord(0, 'maj'), majorKey(0), {
approach: makeChord(0, 'maj', 7), // C/G, the cadential six-four
});
sixFour.type; // 'authentic'
// The rationale says where the cadence began.
sixFour.rationale?.includes('cadential six-four'); // true
Classify the cadence formed by moving from one chord to the next.
These are read as scale degrees rather than as semitone distances, so a mode cadences from and onto the degrees it actually has: the deceptive arrival of dorian is a major sixth above the tonic and that of phrygian a minor sixth, and the subdominant a plagal cadence falls from is the tritone above the tonic in lydian. The two borrowed types are the exception, and are stated as the fixed offsets they name:
modalis the flattened seventh whatever the key writes on that degree, and the Phrygian bass falls from the lowered submediant. A half cadence normally rests on the major third that carries the leading tone, but where the key's own dominant has no leading tone — the modalvof dorian, mixolydian and the pop writing built on them — the arrival's own third suffices as long as the key contains it. That relaxation belongs to the modes alone: a borrowed minorvin a major key is no half cadence, and neither is thevof a minor key, which cadences through the raised seventh it writes as an accidental rather than in its scale.A static V-to-V repeat with no root motion is not a cadence and yields a null type. The tonic six-four resolving onto the dominant it stands on is a half cadence, and the most ordinary one there is:
I - I64 - Vcloses the antecedent of a period, and the six-four is a double appoggiatura over the dominant's own bass rather than a chord that keeps the motion going. Where that dominant goes on to resolve, the pair and the resolution are one event — passing the six-four asapproachwhen the dominant is thefromchord is what lets it be reported as one, with the type and the beat still the dominant's resolution while therationalesays the cadence began at the six-four. A six-four the bass leaves instead (IV-I64-IV, or a neighbouring one over the tonic) is an ordinary inverted tonic and is read as one.An authentic cadence is graded perfect or imperfect. Perfect takes the dominant to the tonic with both chords in root position and the tonic in the soprano; anything else authentic is imperfect, including the leading-tone cadence, which has no dominant root to stand on. Only a
voicingnames the soprano, so without one the grade is null — the pair could still be either, and reporting perfect would be a guess.The
rationalesays which motion the reading rests on, including for a pair that cadences not at all;alternativesis empty unless asked for, and then names the cadences the pair came close to forming.