Sha256: 7aed0ba0c82cc2dc5e233687617d9090741c5bed168ebca76617fc5da6591b15
Contents?: true
Size: 665 Bytes
Versions: 1
Compression:
Stored size: 665 Bytes
Contents
module HeadMusic::Style::Annotations end class HeadMusic::Style::Annotations::MostlyConjunct < HeadMusic::Style::Annotation MESSAGE = "Use mostly conjunct motion." def marks marks_for_skips_and_leaps if conjunct_ratio <= 0.5 end private def marks_for_skips_and_leaps melodic_intervals.map.with_index do |interval, i| HeadMusic::Style::Mark.for_all(notes[i..i+1], fitness: HeadMusic::SMALL_PENALTY_FACTOR) unless interval.step? end.reject(&:nil?) end def conjunct_ratio return 1 if melodic_intervals.empty? steps = melodic_intervals.count { |interval| interval.step? } steps.to_f / melodic_intervals.length end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
head_music-0.13.2 | lib/head_music/style/annotations/mostly_conjunct.rb |