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

    Function toSoundingPitch

    • The pitch an instrument sounds for a written note.

      The interval decides the letter, so the spelling of the part survives the conversion: on a clarinet in A a written C sounds A, a written D sounds B, and a written D# sounds B# — a semitone count alone could answer C natural for that last one and lose the letter the part is written on. A note carrying an octave moves register with it — a written C4 sounds A3 — while an octave-less note stays octave-less, so a pure octave transposer leaves it alone.

      Parameters

      • note: NoteLike

        The written note, as the player reads it: a note name, a MIDI number, note data, or a Note.

      • instrument: TransposingInstrument

        A built-in instrument name, or an interval naming a transposition the table does not carry.

      Returns NoteData

      The sounding note, at concert pitch.

      If the note is malformed, or the instrument is neither a known name nor a spelled interval.

      import { formatNote, parseNote, toSoundingPitch } from '@libraz/libcantus';
      formatNote(toSoundingPitch(parseNote('C4'), 'clarinetA')); // 'A3'
      formatNote(toSoundingPitch('D#4', 'clarinetA')); // 'B#3'
      formatNote(toSoundingPitch(parseNote('C4'), 'piccolo')); // 'C5'