Sha256: e45560ea9bc79151ac63edc742a1bd7da231dcef87d97a8626475ada92f8cfa7
Contents?: true
Size: 744 Bytes
Versions: 18
Compression:
Stored size: 744 Bytes
Contents
# frozen_string_literal: true # Module for style guidelines. module HeadMusic::Style::Guidelines; end # A counterpoint guideline class HeadMusic::Style::Guidelines::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
18 entries across 18 versions & 1 rubygems