Class: HeadMusic::Style::Guidelines::FourToOne
Overview
Constant Summary
collapse
- MESSAGE =
"Use four quarter notes against each whole note in the cantus firmus."
- QUARTER =
HeadMusic::Rudiment::RhythmicValue.get(:quarter)
Instance Method Summary
collapse
Instance Method Details
#check_first_bar(bar_number) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/head_music/style/guidelines/four_to_one.rb', line 12
def check_first_bar(bar_number)
bar_notes = notes_in_bar(bar_number)
bar_rests = rests_in_bar(bar_number)
return if four_quarter_notes?(bar_notes)
return if rest_then_three_quarter_notes?(bar_notes, bar_rests)
return if three_quarter_notes_after_downbeat?(bar_notes)
mark_bar(bar_number)
end
|
#check_middle_bar(bar_number) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/head_music/style/guidelines/four_to_one.rb', line 22
def check_middle_bar(bar_number)
bar_notes = notes_in_bar(bar_number)
return if four_quarter_notes?(bar_notes)
mark_bar(bar_number)
end
|
#four_quarter_notes?(bar_notes) ⇒ Boolean
29
30
31
|
# File 'lib/head_music/style/guidelines/four_to_one.rb', line 29
def four_quarter_notes?(bar_notes)
bar_notes.length == 4 && bar_notes.all? { |note| note.rhythmic_value == QUARTER }
end
|
#rest_then_three_quarter_notes?(bar_notes, bar_rests) ⇒ Boolean
33
34
35
36
37
38
|
# File 'lib/head_music/style/guidelines/four_to_one.rb', line 33
def rest_then_three_quarter_notes?(bar_notes, bar_rests)
bar_notes.length == 3 &&
bar_notes.all? { |note| note.rhythmic_value == QUARTER } &&
bar_rests.length == 1 &&
bar_rests.first.rhythmic_value == QUARTER
end
|
#three_quarter_notes_after_downbeat?(bar_notes) ⇒ Boolean
40
41
42
43
44
|
# File 'lib/head_music/style/guidelines/four_to_one.rb', line 40
def three_quarter_notes_after_downbeat?(bar_notes)
bar_notes.length == 3 &&
bar_notes.all? { |note| note.rhythmic_value == QUARTER } &&
bar_notes.first.position.count > 1
end
|