Class: HeadMusic::Style::Guidelines::SingableRange
Overview
A voice shouldn’t expend the range of a 10th.
Configurable via the maximum_range: option (a diatonic interval number).
Constant Summary
collapse
- MAXIMUM_RANGE =
10
Class Method Summary
collapse
-
.template_values(config) ⇒ Object
Keyed by the interval rather than assembled, because “a” or “an” is a fact about the word that follows it and no template can compute that.
Instance Method Summary
collapse
Class Method Details
.template_values(config) ⇒ Object
Keyed by the interval rather than assembled, because “a” or “an” is a fact
about the word that follows it and no template can compute that. Each
locale writes whatever its grammar needs.
16
17
18
19
|
# File 'lib/head_music/style/guidelines/singable_range.rb', line 16
def self.template_values(config)
range = config.fetch(:maximum_range) { self::MAXIMUM_RANGE }
{range: HeadMusic::Style::Template.render("ranges.#{range}")}
end
|
Instance Method Details
#extremes ⇒ Object
31
32
33
|
# File 'lib/head_music/style/guidelines/singable_range.rb', line 31
def extremes
(highest_notes + lowest_notes).sort
end
|
#maximum_range ⇒ Object
23
24
25
|
# File 'lib/head_music/style/guidelines/singable_range.rb', line 23
def maximum_range
options.fetch(:maximum_range) { self.class::MAXIMUM_RANGE }
end
|
#overage ⇒ Object
27
28
29
|
# File 'lib/head_music/style/guidelines/singable_range.rb', line 27
def overage
notes.any? ? [range.number - maximum_range, 0].max : 0
end
|