Class: HeadMusic::Style::Guidelines::AvoidCrossingVoices

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

Overview

A counterpoint guideline

Constant Summary collapse

MESSAGE =
"Avoid crossing voices. Maintain the high-low relationship between voices."

Instance Method Summary collapse

Constructor Details

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

Instance Method Details

#crossingsObject (private)



16
17
18
19
20
# File 'lib/head_music/style/guidelines/avoid_crossing_voices.rb', line 16

def crossings
  harmonic_intervals.select do |harmonic_interval|
    harmonic_interval.pitch_orientation && harmonic_interval.pitch_orientation != predominant_pitch_orientation
  end
end

#marksObject



8
9
10
11
12
# File 'lib/head_music/style/guidelines/avoid_crossing_voices.rb', line 8

def marks
  crossings.map do |crossing|
    HeadMusic::Style::Mark.for_all(crossing.notes)
  end
end

#pitch_orientationsObject (private)



30
31
32
# File 'lib/head_music/style/guidelines/avoid_crossing_voices.rb', line 30

def pitch_orientations
  harmonic_intervals.map(&:pitch_orientation).compact.uniq
end

#predominant_pitch_orientationObject (private)



22
23
24
25
26
27
28
# File 'lib/head_music/style/guidelines/avoid_crossing_voices.rb', line 22

def predominant_pitch_orientation
  pitch_orientations
    .compact
    .group_by { |orientation| orientation }
    .max { |a, b| a[1].length <=> b[1].length }
    .first
end