Sha256: 72ef80957860776a8f39e4f3e56bf8a5d1bb59e734d0c1fd06c68c648ca6510c
Contents?: true
Size: 731 Bytes
Versions: 10
Compression:
Stored size: 731 Bytes
Contents
module HeadMusic::Style::Annotations end class HeadMusic::Style::Annotations::StepUpToFinalNote < HeadMusic::Style::Annotation MESSAGE = 'Step up to final note.' def marks if !last_melodic_interval.nil? fitness = 1 fitness *= HeadMusic::PENALTY_FACTOR unless step? fitness *= HeadMusic::PENALTY_FACTOR unless ascending? if fitness < 1 HeadMusic::Style::Mark.for_all(notes[-2..-1], fitness: fitness) end end end private def ascending? last_melodic_interval && last_melodic_interval.ascending? 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
10 entries across 10 versions & 1 rubygems