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

    Function checkSpecies

    • Check a species counterpoint exercise and report every rule it breaks.

      The cantus firmus is one note per measure. The counterpoint is aligned to it by position rather than by written rhythm: the first four species have a fixed number of notes per measure, so the note count alone says where each note falls, and a closing measure written as a single whole note is accepted as the convention it is. The fifth species mixes note values and therefore needs opts.durations, given in cantus-firmus notes.

      Judged are the vertical intervals under each species' dissonance licence (none in the first, a passing dissonance on the weak half in the second and third, a prepared suspension on the downbeat in the fourth, both in the fifth; the neighbour that turns back on its own note belongs to the quarter-note line of the third and fifth species, which also write the nota cambiata and the double neighbour, quitting a dissonance by leap). A note still sounding when the next cantus-firmus note is struck is judged against that note too, so a ligature carried across the bar line is read where it lands as well as where it began. Judged besides are parallel and hidden perfects and the battuta between the voices, augmented and otherwise forbidden leaps along the counterpoint, the shape of the counterpoint as a line, and the opening and closing formulas. Violations name the cantus firmus as voice 0 and the counterpoint as voice 1, and index into the counterpoint.

      Parameters

      • cantusFirmus: readonly NoteData[]

        The given voice, one spelled note per measure.

      • counterpoint: readonly NoteData[]

        The written voice, in spelled notes.

      • species: Species

        Which species the exercise is written in.

      • modeLike: KeyLike

        The mode the exercise is in.

      • Optionalopts: SpeciesOptions

        Note lengths, and which side the counterpoint is written on.

      Returns PartWritingViolation[]

      Every violation found, in the order the exercise commits them; an empty array for a clean exercise.

      If the species is not one of the five, either voice is empty, a note carries no octave, or the fifth species is given without durations.

      import { checkSpecies, majorKey, parseNote } from '@libraz/libcantus';
      const cf = ['C4', 'D4', 'E4', 'D4', 'C4'].map((n) => parseNote(n));
      const cp = ['C5', 'A4', 'G4', 'B4', 'C5'].map((n) => parseNote(n));
      checkSpecies(cf, cp, 1, majorKey(0)); // [] — a clean first-species exercise