Sha256: 8f62f638c80f223760630c0d8276576750d878cf7d963970c26d9f686cc12695
Contents?: true
Size: 588 Bytes
Versions: 1
Compression:
Stored size: 588 Bytes
Contents
# frozen_string_literal: true # Module for Annotations. module HeadMusic::Style::Annotations; end # A voice shouldn't expend the range of a 10th. class HeadMusic::Style::Annotations::SingableRange < HeadMusic::Style::Annotation MAXIMUM_RANGE = 10 MESSAGE = 'Limit melodic range to a 10th.' def marks HeadMusic::Style::Mark.for_each(extremes, fitness: HeadMusic::PENALTY_FACTOR**overage) if overage.positive? end private def overage !notes.empty? ? [range.number - MAXIMUM_RANGE, 0].max : 0 end def extremes (highest_notes + lowest_notes).sort end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
head_music-0.18.0 | lib/head_music/style/annotations/singable_range.rb |