Sha256: 0940718d333cbc416ddc39912894a26675df03d070f0b836838e918bf091a24c
Contents?: true
Size: 740 Bytes
Versions: 2
Compression:
Stored size: 740 Bytes
Contents
# frozen_string_literal: true # Module for Annotations. module HeadMusic::Style::Annotations; end # A counterpoint guideline class HeadMusic::Style::Annotations::StepUpToFinalNote < HeadMusic::Style::Annotation MESSAGE = 'Step up to final note.' def marks return if last_melodic_interval.nil? fitness = 1 fitness *= HeadMusic::PENALTY_FACTOR unless step? fitness *= HeadMusic::PENALTY_FACTOR unless ascending? HeadMusic::Style::Mark.for_all(notes[-2..-1], fitness: fitness) if fitness < 1 end private def ascending? last_melodic_interval&.ascending? end def step? 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.19.0 | lib/head_music/style/annotations/step_up_to_final_note.rb |
head_music-0.18.0 | lib/head_music/style/annotations/step_up_to_final_note.rb |