Class: HeadMusic::Style::Guidelines::AllowedRhythmicValuesForCombined234

Inherits:
Annotation
  • Object
show all
Defined in:
lib/head_music/style/guidelines/allowed_rhythmic_values_for_combined234.rb

Overview

Validates that counterpoint notes use only half notes, quarter notes, and tied notes. No whole notes filling an entire bar from beat 1. Appropriate for combined second, third, and fourth species counterpoint.

Constant Summary collapse

MESSAGE =
"Use only half notes, quarter notes, and tied notes. Avoid whole notes on beat 1."

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from HeadMusic::Style::Annotation

Instance Method Details

#marksObject



10
11
12
# File 'lib/head_music/style/guidelines/allowed_rhythmic_values_for_combined234.rb', line 10

def marks
  violating_notes.map { |note| HeadMusic::Style::Mark.for(note) }
end

#violating_notesObject (private)



16
17
18
# File 'lib/head_music/style/guidelines/allowed_rhythmic_values_for_combined234.rb', line 16

def violating_notes
  notes.select { |note| whole_note_on_downbeat?(note) }
end

#whole_note_on_downbeat?(note) ⇒ Boolean (private)

Returns:

  • (Boolean)


20
21
22
# File 'lib/head_music/style/guidelines/allowed_rhythmic_values_for_combined234.rb', line 20

def whole_note_on_downbeat?(note)
  note.rhythmic_value.total_value >= 1.0 && note.position.count == 1
end