pitchClass property

int get pitchClass

Returns the pitch class as an integer 0–11, as per the MEI v5 pclass attribute. C=0, C#=1, D=2, ..., B=11.

Implementation

int get pitchClass {
  const stepToSemitone = {
    'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11,
  };
  return ((stepToSemitone[step]! + effectiveAlter.round()) % 12 + 12) % 12;
}