@libraz/libcantus - v0.9.3
    Preparing search index...

    Function tensionCurve

    • Sample the harmonic tension of an arrangement at regular beats.

      At each sample beat the tension combines three normalized terms:

      • the sounding chord's harmonic function (dominant 1, subdominant 0.5, tonic or no chord 0), weighted FUNCTION_WEIGHT;
      • the dissonance of the sounding notes — the larger of the share of sounding pitches that are not chord tones and the share that evaluateSafety rates NoteSafety.Dissonant — weighted DISSONANCE_WEIGHT;
      • the registral span of the sounding notes, saturating at SPAN_SATURATION semitones, weighted SPAN_WEIGHT.

      The weighted sum is clamped to [0, 1]. The harmony is inferred from all tracks pooled together, so the result is deterministic and self-contained.

      Parameters

      Returns TensionPoint[]

      One TensionPoint per sampled beat, in beat order.

      If step is not positive.

      import { tensionCurve } from '@libraz/libcantus';
      const notes = [{ pitch: 60, startBeat: 0, durationBeat: 4 }];
      const curve = tensionCurve([{ notes }], { step: 1 });
      curve; // one { beat, tension } sample per beat, in beat order