Sha256: 5dbeba1d5c83a9aa5e399a03c9c3ae88d293108c143998d8e3d5f7eaff69f7a9
Contents?: true
Size: 742 Bytes
Versions: 2
Compression:
Stored size: 742 Bytes
Contents
module HeadMusic::Style::Annotations end class HeadMusic::Style::Annotations::StepDownToFinalNote < HeadMusic::Style::Annotation MESSAGE = 'Step down to the final note.' 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
head_music-0.17.0 | lib/head_music/style/annotations/step_down_to_final_note.rb |
head_music-0.16.2 | lib/head_music/style/annotations/step_down_to_final_note.rb |