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

    Function analyzeReference

    • Read a piece's structure into a ReferenceProfile: its form, phrase shapes, harmonic function and rhythm, motif derivations and melodic rhythm, without the notes themselves.

      The melody is the melody option when given, and otherwise the top line of the notes — notes struck together read as one event, the highest standing for it — so a piano part read whole answers for its upper voice. The harmony is the timeline option when given, and otherwise inferred from all the notes. The motif search expects quantized onsets.

      The sections are cut on the hyperbar grouping the phrase reading settles on, which weighs where the harmony cadences; sectionsFromNotes alone groups without the cadences, so the two can differ.

      Parameters

      Returns ReferenceProfile

      The profile.

      If the notes or an option cannot be read.

      If an analysis would exceed the budget.

      import { analyzeReference } from '@libraz/libcantus';
      const triad = (pitches: number[], startBeat: number) =>
      pitches.map((pitch) => ({ pitch, startBeat, durationBeat: 4 }));
      const notes = [
      ...triad([60, 64, 67], 0),
      ...triad([65, 69, 72], 4),
      ...triad([67, 71, 74], 8),
      ...triad([60, 64, 67], 12),
      ];
      const profile = analyzeReference(notes, { key: 'C major' });
      profile.harmony.chords.map((chord) => chord.roman); // ['I', 'IV', 'V', 'I']
      profile.span.bars; // 4