class HeadMusic::Style::Guidelines::AvoidCrossingVoices

A counterpoint guideline

Constants

MESSAGE

Public Instance Methods

marks() click to toggle source
# File lib/head_music/style/guidelines/avoid_crossing_voices.rb, line 10
def marks
  crossings.map do |crossing|
    HeadMusic::Style::Mark.for_all(crossing.notes)
  end
end

Private Instance Methods

crossings() click to toggle source
# File lib/head_music/style/guidelines/avoid_crossing_voices.rb, line 18
def crossings
  harmonic_intervals.select do |harmonic_interval|
    harmonic_interval.pitch_orientation && harmonic_interval.pitch_orientation != predominant_pitch_orientation
  end
end
pitch_orientations() click to toggle source
# File lib/head_music/style/guidelines/avoid_crossing_voices.rb, line 32
def pitch_orientations
  harmonic_intervals.map(&:pitch_orientation).compact.uniq
end
predominant_pitch_orientation() click to toggle source
# File lib/head_music/style/guidelines/avoid_crossing_voices.rb, line 24
def predominant_pitch_orientation
  pitch_orientations.
    compact.
    group_by { |orientation| orientation }.
    max { |a, b| a[1].length <=> b[1].length }.
    first
end