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

    Function scaleLadderPosition

    • Locate a pitch on the key's ladder of scale tones.

      Anything counting in scale degrees has to put a pitch on this ladder and back again afterwards. Keeping the chromatic offset apart from the rung is what lets a note between two scale tones survive the arithmetic as the note it was: without it a shift by any number of degrees — including none — would first flatten every chromatic pitch onto the scale.

      In C major, C# sits on the tonic's rung with an offset of one semitone.

      Layer-internal: the generators count degrees with it, and callers reach the same arithmetic through the transforms that use it.

      Parameters

      • pitch: number

        MIDI pitch.

      • key: KeyLike

        The key/scale to count along, as a key name, a key/scale, or a Key.

      Returns ScaleLadderPosition

      The rung the pitch sits on and its semitone offset above it.