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

    Function evaluateSafety

    • Evaluate the safety of placing a candidate pitch in a voice.

      Reasons are merged from harmonic context (chord tone / tension / avoid / scale) and counterpoint (vertical dissonance, parallels, voice crossing). The strict profile treats avoid notes and parallels as dissonant; pop treats them as warnings. The final verdict is the worst severity among the reasons.

      Parameters

      Returns SafetyResult

      The verdict, reason bitmask, and optional resolution guidance.

      If the profile is not one of the profile names, or if any pitch in the query is not a MIDI pitch in 0..127 (InvalidInputError).

      import { evaluateSafety, makeChord, majorKey, NoteSafety } from '@libraz/libcantus';
      const result = evaluateSafety({
      profile: 'pop',
      candidatePitch: 60, // C over a C major chord
      chord: makeChord(0, 'maj'),
      key: majorKey(0),
      otherVoices: [],
      strongBeat: true,
      });
      result.safety === NoteSafety.Safe; // true — C is a chord tone