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

    Function shiftByScaleDegrees

    • Shift a pitch by scale degrees along the key's ladder of scale tones.

      A pitch between two scale tones keeps its distance above the one below it, so a chromatic passing note is still a chromatic passing note after the shift, and a shift of no degrees returns the pitch untouched: a step up the C-major ladder answers C# with D#, not with D.

      Layer-internal. It is what transposeDiatonic and a tonal imitation both count along, so the two answer the same shift the same way; a caller reaches it through either of them.

      Parameters

      • pitch: number

        MIDI pitch to shift.

      • degrees: number

        Scale degrees to move by; negative moves down.

      • key: KeyLike

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

      Returns number

      The shifted pitch.