arpeggioPitchClasses function

Set<int> arpeggioPitchClasses(
  1. ChordSymbol chord
)

O arpejo de Rawlins (arpeggio-3579): 1-3-5-7 nos menores com sétima (m7, m7b5, dim7) e 3-5-7-9 nos maiores e dominantes. Os outros acordes contam as próprias notas. O sentido do arpejo (subindo ou descendo) não entra.

Implementation

Set<int> arpeggioPitchClasses(ChordSymbol chord) {
  final root = chord.root % 12;
  final third = chord.third;
  final fifth = chord.fifth;
  final seventh = chord.seventh;
  return switch (chord.quality) {
    ChordQuality.minor ||
    ChordQuality.minor7 ||
    ChordQuality.halfDiminished7 ||
    ChordQuality.diminished7 => {
      root,
      if (third != null) (root + third) % 12,
      (root + fifth) % 12,
      if (seventh != null) (root + seventh) % 12,
    },
    ChordQuality.major || ChordQuality.major7 || ChordQuality.dominant7 => {
      if (third != null) (root + third) % 12,
      (root + fifth) % 12,
      if (seventh != null) (root + seventh) % 12,
      (root + 2) % 12,
    },
    _ => chord.pitchClasses,
  };
}