harmonyProblems function

List<String> harmonyProblems(
  1. List<HarmonySegment> segments,
  2. List<HarmonyChord> chords
)

Os avisos do autor: os trechos (com nota) em que nenhum acorde de chords cabe. Ex.: "o compasso 5 não tem acorde em chords que contenha Fá♯".

Implementation

List<String> harmonyProblems(
  List<HarmonySegment> segments,
  List<HarmonyChord> chords,
) {
  final out = <String>[];
  for (final segment in segments) {
    if (fittingChords(segment, chords).isNotEmpty) continue;
    final note = segment.first;
    if (note == null) continue;
    out.add(
      'o compasso ${segment.measure + 1} não tem acorde em `chords` que '
      'contenha ${pitchNameOf(note.pitch)}',
    );
  }
  return out;
}