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

    Function transformMotif

    • Apply a transformation to a motif cell.

      invert reflects pitches about the first note (chromatic, self-inverse); retrograde mirrors onsets about the cell span, preserving rests (self-inverse); augment/diminish scale time by amount ?? 2 and its reciprocal; transposeChromatic adds amount semitones; transposeDiatonic shifts by amount scale degrees when a key is given, or — with no key — falls back to a chromatic shift of amount semitones; sequence appends a shifted copy (by amount diatonic degrees with a key, or by amount semitones without one, since it delegates to transposeDiatonic).

      Parameters

      • cell: MotifCell

        The cell to transform.

      • t: MotifTransform

        The transformation.

      • Optionalamount: number

        Optional parameter (semitones, degrees, or time factor).

      • Optionalkey: KeyScale

        Key context for the diatonic transforms; without it, transposeDiatonic and sequence shift chromatically by semitones.

      Returns MotifCell

      The transformed cell.

      import { generateMotif, transformMotif, majorKey } from '@libraz/libcantus';
      const cell = generateMotif({ key: majorKey(0), bars: 1 });
      const inverted = transformMotif(cell, 'invert');