Class: HeadMusic::Style::Guidelines::ThreeToOne
Overview
Constant Summary
collapse
- MESSAGE =
"Use three quarter notes against each dotted half note in the cantus firmus."
- QUARTER =
HeadMusic::Rudiment::RhythmicValue.get(:quarter)
- DOTTED_HALF =
HeadMusic::Rudiment::RhythmicValue.get(:dotted_half)
Instance Method Summary
collapse
Instance Method Details
#check_final_bar(bar_number) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/head_music/style/guidelines/three_to_one.rb', line 30
def check_final_bar(bar_number)
bar_notes = notes_in_bar(bar_number)
return if one_dotted_half_note?(bar_notes)
mark_bar(bar_number)
end
|
#check_first_bar(bar_number) ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/head_music/style/guidelines/three_to_one.rb', line 13
def check_first_bar(bar_number)
bar_notes = notes_in_bar(bar_number)
bar_rests = rests_in_bar(bar_number)
return if three_quarter_notes?(bar_notes)
return if rest_then_two_quarter_notes?(bar_notes, bar_rests)
return if two_quarter_notes_after_downbeat?(bar_notes)
mark_bar(bar_number)
end
|
#check_middle_bar(bar_number) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/head_music/style/guidelines/three_to_one.rb', line 23
def check_middle_bar(bar_number)
bar_notes = notes_in_bar(bar_number)
return if three_quarter_notes?(bar_notes)
mark_bar(bar_number)
end
|
#one_dotted_half_note?(bar_notes) ⇒ Boolean
54
55
56
|
# File 'lib/head_music/style/guidelines/three_to_one.rb', line 54
def one_dotted_half_note?(bar_notes)
bar_notes.length == 1 && bar_notes.first.rhythmic_value == DOTTED_HALF
end
|
#rest_then_two_quarter_notes?(bar_notes, bar_rests) ⇒ Boolean
41
42
43
44
45
46
|
# File 'lib/head_music/style/guidelines/three_to_one.rb', line 41
def rest_then_two_quarter_notes?(bar_notes, bar_rests)
bar_notes.length == 2 &&
bar_notes.all? { |note| note.rhythmic_value == QUARTER } &&
bar_rests.length == 1 &&
bar_rests.first.rhythmic_value == QUARTER
end
|
#three_quarter_notes?(bar_notes) ⇒ Boolean
37
38
39
|
# File 'lib/head_music/style/guidelines/three_to_one.rb', line 37
def three_quarter_notes?(bar_notes)
bar_notes.length == 3 && bar_notes.all? { |note| note.rhythmic_value == QUARTER }
end
|
#two_quarter_notes_after_downbeat?(bar_notes) ⇒ Boolean
48
49
50
51
52
|
# File 'lib/head_music/style/guidelines/three_to_one.rb', line 48
def two_quarter_notes_after_downbeat?(bar_notes)
bar_notes.length == 2 &&
bar_notes.all? { |note| note.rhythmic_value == QUARTER } &&
bar_notes.first.position.count > 1
end
|