Class: HeadMusic::Style::Guidelines::PrepareOctaveLeaps
- Inherits:
-
Annotation
- Object
- Annotation
- HeadMusic::Style::Guidelines::PrepareOctaveLeaps
show all
- Defined in:
- lib/head_music/style/guidelines/prepare_octave_leaps.rb
Overview
Constant Summary
collapse
- MESSAGE =
"Enter and exit an octave leap from within."
Instance Method Summary
collapse
Instance Method Details
#external_entries ⇒ Object
32
33
34
|
# File 'lib/head_music/style/guidelines/prepare_octave_leaps.rb', line 32
def external_entries
external_leaps { |first, second| second.octave? && !second.spans?(first.pitches.first) }
end
|
#external_entries_marks ⇒ Object
14
15
16
17
18
|
# File 'lib/head_music/style/guidelines/prepare_octave_leaps.rb', line 14
def external_entries_marks
external_entries.map do |trouble_spot|
HeadMusic::Style::Mark.for_all(trouble_spot)
end
end
|
#external_exits ⇒ Object
36
37
38
|
# File 'lib/head_music/style/guidelines/prepare_octave_leaps.rb', line 36
def external_exits
external_leaps { |first, second| first.octave? && !first.spans?(second.pitches.last) }
end
|
#external_exits_marks ⇒ Object
20
21
22
23
24
|
# File 'lib/head_music/style/guidelines/prepare_octave_leaps.rb', line 20
def external_exits_marks
external_exits.map do |trouble_spot|
HeadMusic::Style::Mark.for_all(trouble_spot)
end
end
|
#external_leaps ⇒ Object
Adjacent melodic-interval pairs whose octave leap is approached or left from
outside the span, as decided by the given predicate.
42
43
44
45
46
47
|
# File 'lib/head_music/style/guidelines/prepare_octave_leaps.rb', line 42
def external_leaps
melodic_note_pairs.each_cons(2).filter_map do |pair|
first, second = *pair
pair.map(&:notes).flatten.uniq if yield(first, second)
end
end
|
#marks ⇒ Object
8
9
10
|
# File 'lib/head_music/style/guidelines/prepare_octave_leaps.rb', line 8
def marks
external_entries_marks + external_exits_marks + octave_ending_marks
end
|
#octave_ending ⇒ Object
49
50
51
|
# File 'lib/head_music/style/guidelines/prepare_octave_leaps.rb', line 49
def octave_ending
octave_ending? ? melodic_note_pairs.last.notes : []
end
|
#octave_ending? ⇒ Boolean
53
54
55
|
# File 'lib/head_music/style/guidelines/prepare_octave_leaps.rb', line 53
def octave_ending?
melodic_note_pairs.last&.octave?
end
|
#octave_ending_marks ⇒ Object
26
27
28
29
30
|
# File 'lib/head_music/style/guidelines/prepare_octave_leaps.rb', line 26
def octave_ending_marks
return [] unless octave_ending?
[HeadMusic::Style::Mark.for_all(octave_ending)]
end
|