Sha256: 1668dd2bbbf6f84c7e391532166de93846fe6135f62840f4ca386dc8b7da65e2

Contents?: true

Size: 631 Bytes

Versions: 21

Compression:

Stored size: 631 Bytes

Contents

# frozen_string_literal: true

# Module for style guidelines.
module HeadMusic::Style::Guidelines; end

# A counterpoint guideline
class HeadMusic::Style::Guidelines::ConsonantDownbeats < HeadMusic::Style::Annotation
  MESSAGE = 'Use consonant harmonic intervals on every downbeat.'

  def marks
    dissonant_pairs.map do |dissonant_pair|
      HeadMusic::Style::Mark.for_all(dissonant_pair)
    end.flatten
  end

  private

  def dissonant_pairs
    dissonant_intervals.map(&:notes).compact
  end

  def dissonant_intervals
    downbeat_harmonic_intervals.select { |interval| interval.dissonance?(:two_part_harmony) }
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
head_music-0.19.1 lib/head_music/style/guidelines/consonant_downbeats.rb