Sha256: 8e58b239c2b0b9f824fc891adabb77653aca2e336977dabe5d20124ee9eac529
Contents?: true
Size: 502 Bytes
Versions: 9
Compression:
Stored size: 502 Bytes
Contents
module HeadMusic::Style::Annotations end class HeadMusic::Style::Annotations::LimitRange < HeadMusic::Style::Annotation MAXIMUM_RANGE = 10 def message 'Limit melodic range to a 10th.' end def marks if overage > 0 HeadMusic::Style::Mark.for_each(extremes, fitness: HeadMusic::PENALTY_FACTOR**overage) end end private def overage notes.length > 0 ? [range.number - MAXIMUM_RANGE, 0].max : 0 end def extremes (highest_notes + lowest_notes).sort end end
Version data entries
9 entries across 9 versions & 1 rubygems