Class: HeadMusic::Style::Guidelines::MostlyConjunct
- Inherits:
-
HeadMusic::Style::Guideline
- Object
- HeadMusic::Style::Guideline
- HeadMusic::Style::Guidelines::MostlyConjunct
- 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
-
#conjunct_ratio ⇒ Object
private
-
#marks ⇒ Object
~38% Fux is 5/13 for lydian cantus firmus.
-
#marks_for_skips_and_leaps ⇒ Object
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.
-
#minimum_conjunct_portion ⇒ Object
private
Constructor Details
This class inherits a constructor from HeadMusic::Style::Guideline
Instance Method Details
#conjunct_ratio ⇒ Object (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 |
#marks ⇒ Object
~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_leaps ⇒ Object (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_portion ⇒ Object (private)
19 20 21 |
# File 'lib/head_music/style/guidelines/mostly_conjunct.rb', line 19 def minimum_conjunct_portion .fetch(:minimum_conjunct_portion) { self.class::MINIMUM_CONJUNCT_PORTION } end |