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

    Function transposeByInterval

    • Transpose a note by a spelled interval, keeping the spelling the interval names.

      Unlike transposeNote, which picks a letter from the semitone count, the diatonic number decides the letter here: transposing C by an augmented second gives D#, not Eb.

      Both arguments are taken in whatever form the caller holds them — the text a field carries, the plain data the library returns, or the class that wraps it — as the class mirror of this operation already did.

      Parameters

      • given: NoteLike

        The note to transpose: a name, a MIDI number, plain note data, or a Note.

      • named: IntervalLike

        The interval to apply: a name, plain interval data, or an Interval. A negative span transposes downward.

      Returns NoteData

      The transposed note, octave-less if the source was.

      import { formatNote, transposeByInterval } from '@libraz/libcantus';
      formatNote(transposeByInterval('C4', 'A2')); // 'D#4'