Class: HeadMusic::Style::Guidelines::SingableIntervals
- Inherits:
-
Annotation
- Object
- Annotation
- HeadMusic::Style::Guidelines::SingableIntervals
show all
- Defined in:
- lib/head_music/style/guidelines/singable_intervals.rb
Overview
Constant Summary
collapse
- PERMITTED_ASCENDING =
%w[PU m2 M2 m3 M3 P4 P5 m6 P8].freeze
- PERMITTED_DESCENDING =
%w[PU m2 M2 m3 M3 P4 P5 P8].freeze
- MESSAGE =
"Use only PU, m2, M2, m3, M3, P4, P5, m6 (ascending), P8 in the melodic line."
Instance Method Summary
collapse
Instance Method Details
#marks ⇒ Object
11
12
13
14
15
|
# File 'lib/head_music/style/guidelines/singable_intervals.rb', line 11
def marks
melodic_note_pairs.reject { |note_pair| permitted?(note_pair) }.map do |pair_with_unpermitted_interval|
HeadMusic::Style::Mark.for_all(pair_with_unpermitted_interval.notes)
end
end
|
#permitted?(note_pair) ⇒ Boolean
19
20
21
22
|
# File 'lib/head_music/style/guidelines/singable_intervals.rb', line 19
def permitted?(note_pair)
melodic_interval = note_pair.melodic_interval
whitelist_for_interval(melodic_interval).include?(melodic_interval.shorthand)
end
|
#whitelist_for_interval(melodic_interval) ⇒ Object
24
25
26
|
# File 'lib/head_music/style/guidelines/singable_intervals.rb', line 24
def whitelist_for_interval(melodic_interval)
melodic_interval.ascending? ? PERMITTED_ASCENDING : PERMITTED_DESCENDING
end
|