Sha256: d8543e8551bbd6e05cb6e956c793666ae88640605ac0ad18d3dbef90902a18f5

Contents?: true

Size: 838 Bytes

Versions: 17

Compression:

Stored size: 838 Bytes

Contents

# frozen_string_literal: true

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

# A counterpoint guideline
class HeadMusic::Style::Guidelines::ApproachPerfectionContrarily < HeadMusic::Style::Annotation
  MESSAGE = 'Approach perfect consonances by contrary motion.'

  def marks
    motions_to_perfect_consonance_approached_directly.map do |bad_motion|
      HeadMusic::Style::Mark.for_all(bad_motion.notes)
    end
  end

  private

  def motions_to_perfect_consonance_approached_directly
    motions_to_perfect_consonance.select(&:direct?)
  end

  def motions_to_perfect_consonance
    motions.select do |motion|
      motion.second_harmonic_interval.perfect_consonance?
    end
  end

  # Side effect is that you can't enter a perfect consonance by skip in similar or parallel motion,
  # which is a rule.
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
head_music-0.27.0 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.26.3 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.26.2 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.26.1 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.26.0 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.25.0 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.24.5 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.24.4 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.24.3 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.24.2 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.24.1 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.24.0 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.23.4 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.23.3 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.23.2 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.23.1 lib/head_music/style/guidelines/approach_perfection_contrarily.rb
head_music-0.23.0 lib/head_music/style/guidelines/approach_perfection_contrarily.rb