Class: HeadMusic::Style::Guidelines::MostlyConjunct

Inherits:
HeadMusic::Style::Guideline show all
Defined in:
lib/head_music/style/guidelines/mostly_conjunct.rb

Overview

A counterpoint guideline. Configurable via the minimum_conjunct_portion: option (the minimum fraction of melodic motion that must be stepwise).

Constant Summary collapse

MINIMUM_CONJUNCT_PORTION =
HeadMusic::GOLDEN_RATIO_INVERSE**2

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from HeadMusic::Style::Guideline

Instance Method Details

#conjunct_ratioObject (private)



35
36
37
38
39
# File 'lib/head_music/style/guidelines/mostly_conjunct.rb', line 35

def conjunct_ratio
  return 1 if melodic_note_pairs.empty?

  melodic_note_pairs.count(&:step?).to_f / melodic_note_pairs.length
end

#marksObject

~38% Fux is 5/13 for lydian cantus firmus



13
14
15
# File 'lib/head_music/style/guidelines/mostly_conjunct.rb', line 13

def marks
  marks_for_skips_and_leaps if conjunct_ratio < minimum_conjunct_portion
end

#marks_for_skips_and_leapsObject (private)

Marked at the default rather than the small penalty: this guideline is soft all the way through and says so with strength :weak, which is what a rubric weight is for. The small penalty said it inside the item’s own fitness, where it also decided how fast the item collapsed on repeats – and every skip and leap is marked once this trips, so six leaps used to land at 0.786^6 = 0.236 and now land at 0.618^6 = 0.056.



29
30
31
32
33
# File 'lib/head_music/style/guidelines/mostly_conjunct.rb', line 29

def marks_for_skips_and_leaps
  melodic_note_pairs
    .reject(&:step?)
    .map { |note_pair| HeadMusic::Style::Mark.for_all(note_pair.notes) }
end

#minimum_conjunct_portionObject (private)



19
20
21
# File 'lib/head_music/style/guidelines/mostly_conjunct.rb', line 19

def minimum_conjunct_portion
  options.fetch(:minimum_conjunct_portion) { self.class::MINIMUM_CONJUNCT_PORTION }
end