Class: HeadMusic::Style::Guidelines::NoParallelPerfect
- Inherits:
-
Annotation
- Object
- Annotation
- HeadMusic::Style::Guidelines::NoParallelPerfect
show all
- Defined in:
- lib/head_music/style/guidelines/no_parallel_perfect.rb
Overview
Base class for guidelines flagging parallel perfect consonances between
consecutive harmonic intervals. Subclasses supply the set of harmonic
intervals to analyze (e.g. downbeats or all syncopated positions).
Instance Method Summary
collapse
Instance Method Details
#analyzed_harmonic_intervals ⇒ Object
16
17
18
|
# File 'lib/head_music/style/guidelines/no_parallel_perfect.rb', line 16
def analyzed_harmonic_intervals
raise NotImplementedError
end
|
#marks ⇒ Object
8
9
10
11
12
|
# File 'lib/head_music/style/guidelines/no_parallel_perfect.rb', line 8
def marks
parallel_perfect_pairs.map do |pair|
HeadMusic::Style::Mark.for_all(pair.flat_map(&:notes))
end
end
|
#parallel_perfect_pairs ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/head_music/style/guidelines/no_parallel_perfect.rb', line 20
def parallel_perfect_pairs
analyzed_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
28
29
30
|
# File 'lib/head_music/style/guidelines/no_parallel_perfect.rb', line 28
def same_simple_type?(first, second)
first.simple_number == second.simple_number
end
|