Sha256: 85bc6f6a6d44072e8a3b9b021d05cd56fbf7a1e67d2d2f05647e2279407798cf
Contents?: true
Size: 816 Bytes
Versions: 3
Compression:
Stored size: 816 Bytes
Contents
# frozen_string_literal: true # Module for style guidelines. module HeadMusic::Style::Guidelines; end # A counterpoint guideline class HeadMusic::Style::Guidelines::MostlyConjunct < HeadMusic::Style::Annotation MESSAGE = 'Use mostly conjunct motion.' MINIMUM_CONJUNCT_PORTION = HeadMusic::GOLDEN_RATIO_INVERSE**2 # ~38% # Fux is 5/13 for lydian cantus firmus def marks marks_for_skips_and_leaps if conjunct_ratio < MINIMUM_CONJUNCT_PORTION end private def marks_for_skips_and_leaps melodic_intervals. reject(&:step?). map { |interval| HeadMusic::Style::Mark.for_all(interval.notes, fitness: HeadMusic::SMALL_PENALTY_FACTOR) } end def conjunct_ratio return 1 if melodic_intervals.empty? melodic_intervals.count(&:step?).to_f / melodic_intervals.length end end
Version data entries
3 entries across 3 versions & 1 rubygems