Class: HeadMusic::Style::Guidelines::NoParallelPerfectOnDownbeats
- Inherits:
-
Annotation
- Object
- Annotation
- HeadMusic::Style::Guidelines::NoParallelPerfectOnDownbeats
show all
- Defined in:
- lib/head_music/style/guidelines/no_parallel_perfect_on_downbeats.rb
Overview
Constant Summary
collapse
- MESSAGE =
"Avoid parallel perfect consonances on consecutive downbeats."
Instance Method Summary
collapse
Instance Method Details
#marks ⇒ Object
8
9
10
11
12
|
# File 'lib/head_music/style/guidelines/no_parallel_perfect_on_downbeats.rb', line 8
def marks
parallel_perfect_downbeat_pairs.map do |pair|
HeadMusic::Style::Mark.for_all(pair.flat_map(&:notes))
end
end
|
#parallel_perfect_downbeat_pairs ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/head_music/style/guidelines/no_parallel_perfect_on_downbeats.rb', line 16
def parallel_perfect_downbeat_pairs
downbeat_harmonic_intervals.each_cons(2).select do |first, second|
first.perfect_consonance?(:two_part_harmony) &&
second.perfect_consonance?(:two_part_harmony) &&
same_simple_type?(first, second)
end
end
|
#same_simple_type?(first, second) ⇒ Boolean
24
25
26
|
# File 'lib/head_music/style/guidelines/no_parallel_perfect_on_downbeats.rb', line 24
def same_simple_type?(first, second)
first.simple_number == second.simple_number
end
|