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

    Function melodicContour

    • Read the shape of a line.

      The step directions are the literal answer; the shape is what they add up to. A line is called ascending or descending when most of its motion runs one way, not only when every step does — a climb with one dip in it is still heard as a climb — and an arch when it rises to an interior peak and comes back down. Anything that keeps changing direction is a wave, and a line that does not move is static.

      The line is expected to be monophonic, as analyzeVoice expects a voice to be; split polyphonic material into lines first. Notes struck together are read as one event, the highest of them standing for it — a chord and the note after it trace one step, not a climb through the chord — so a piano part read whole answers for its top voice rather than for a line no one plays.

      Parameters

      • notes: MelodicPhrase

        The line: a motif, or plain note events. Notes that never sound are dropped, and notes sharing an onset are folded to their top voice.

      Returns MelodicContour

      The directions, the shape, the peak and trough, and a rationale. A line with no sounding notes is static with a range of 0, and its peak and trough are -1: there is no note for them to point at.

      import { melodicContour } from '@libraz/libcantus';
      const notes = [
      { pitch: 60, startBeat: 0, durationBeat: 1 },
      { pitch: 64, startBeat: 1, durationBeat: 1 },
      { pitch: 60, startBeat: 2, durationBeat: 1 },
      ];
      melodicContour(notes).shape; // 'arch'