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

    Function transposeChord

    • Transpose a chord by a number of semitones.

      The interval template is carried over untouched, so a chord whose intervals were customised keeps them, and a slash bass moves with the root. Enharmonic spelling hints are dropped rather than shifted: the letter a transposed root should take depends on the destination key, which a semitone count does not carry. Pass the result through spellChord to respell it.

      Parameters

      • chord: ChordData

        The chord to transpose.

      • semitones: number

        The signed semitone offset.

      Returns ChordData

      The transposed chord.

      If semitones is not finite.

      import { formatChordSymbol, parseChordSymbol, transposeChord } from '@libraz/libcantus';
      formatChordSymbol(transposeChord(parseChordSymbol('C/G'), 2)); // 'D/A'