Sha256: b0336f378d49f4afd2a6a57b7ff37437657c145d375df3bedf816b255f5103e5

Contents?: true

Size: 683 Bytes

Versions: 2

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

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

# marks the voice if the first note is not the first or fifth scale degree of the key.
class HeadMusic::Style::Annotations::StartOnPerfectConsonance < HeadMusic::Style::Annotation
  MESSAGE = 'Start on the tonic or a perfect consonance above the tonic (unless bass voice).'

  def marks
    return unless first_note && ((bass_voice? && !starts_on_tonic?) || !starts_on_perfect_consonance?)
    HeadMusic::Style::Mark.for(first_note)
  end

  private

  def starts_on_perfect_consonance?
    functional_interval_from_tonic(first_note).perfect_consonance?(: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/start_on_perfect_consonance.rb
head_music-0.18.0 lib/head_music/style/annotations/start_on_perfect_consonance.rb