Sha256: bc909f12be3766c73322a7f7868d7bf3a9cbb6e8ab223e284c2ba89bf0176d59

Contents?: true

Size: 628 Bytes

Versions: 2

Compression:

Stored size: 628 Bytes

Contents

# frozen_string_literal: true

# Module for Annotations.
module HeadMusic::Style::Annotations; end

# A counterpoint guideline
class HeadMusic::Style::Annotations::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

2 entries across 2 versions & 1 rubygems

Version Path
head_music-0.19.0 lib/head_music/style/annotations/consonant_downbeats.rb
head_music-0.18.0 lib/head_music/style/annotations/consonant_downbeats.rb