Sha256: b609b19cf3c2fdd5958c507a323914c62af645525406742c0fc4c07c1dd17955
Contents?: true
Size: 750 Bytes
Versions: 9
Compression:
Stored size: 750 Bytes
Contents
module HeadMusic::Style::Annotations end class HeadMusic::Style::Annotations::StepDownToFinalNote < HeadMusic::Style::Annotation def message 'Step down to final note.' end def marks if !last_melodic_interval.nil? fitness = 1 fitness *= HeadMusic::PENALTY_FACTOR unless step? fitness *= HeadMusic::PENALTY_FACTOR unless descending? if fitness < 1 HeadMusic::Style::Mark.for_all(notes[-2..-1], fitness: fitness) end end end private def descending? last_melodic_interval && last_melodic_interval.descending? end def step? last_melodic_interval && last_melodic_interval.step? end def last_melodic_interval @last_melodic_interval ||= melodic_intervals.last end end
Version data entries
9 entries across 9 versions & 1 rubygems