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

    Function pitchClassOf

    • Reduce a MIDI pitch, a bare pitch class, or any signed offset to a pitch class in [0, 11].

      This is the library's single definition of pitch-class arithmetic: every layer routes through it so a fractional pitch reduces the same way everywhere. A non-integral input is rounded to the nearest semitone first, so a microtonal 60.6 reads as C# rather than C.

      Parameters

      • value: number

        A MIDI pitch, pitch class, or signed semitone offset.

      Returns number

      The pitch class in [0, 11].

      import { pitchClassOf } from '@libraz/libcantus';
      pitchClassOf(61); // 1
      pitchClassOf(-1); // 11
      pitchClassOf(60.6); // 1