Sha256: 0c1b9b6a55ac07ecc80823e633900777734f0af2c5c3933a26762e89bf5bf991
Contents?: true
Size: 677 Bytes
Versions: 9
Compression:
Stored size: 677 Bytes
Contents
module HeadMusic::Style::Annotations end class HeadMusic::Style::Annotations::MostlyConjunct < HeadMusic::Style::Annotation def message "Use mostly conjunct motion." end 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
9 entries across 9 versions & 1 rubygems