Class: HeadMusic::Style::Guidelines::MixedRhythmicValues

Inherits:
Annotation
  • Object
show all
Defined in:
lib/head_music/style/guidelines/mixed_rhythmic_values.rb

Overview

Checks that the voice uses at least 3 different rhythmic value durations. Florid counterpoint requires a genuine mixture of species textures.

Constant Summary collapse

MESSAGE =
"Use at least three different rhythmic values for a truly florid line."

Instance Method Summary collapse

Constructor Details

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

Instance Method Details

#distinct_durations_countObject (private)



18
19
20
# File 'lib/head_music/style/guidelines/mixed_rhythmic_values.rb', line 18

def distinct_durations_count
  notes.map { |note| note.rhythmic_value.total_value }.uniq.length
end

#marksObject



9
10
11
12
13
14
# File 'lib/head_music/style/guidelines/mixed_rhythmic_values.rb', line 9

def marks
  return [] if notes.length < 2
  return [] if distinct_durations_count >= 3

  [HeadMusic::Style::Mark.for(notes.first)]
end