@libraz/libcantus - v0.9.3
    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

      • q: SafetyQuery

        The candidate and its harmonic/voice-leading context.

      Returns SafetyResult

      The verdict, reason bitmask, and optional resolution guidance.

      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