Sha256: e0e04f37b45acfbc92359b5618bda0ba33302515650afd666d16f701e2321240

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

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::EndOnPerfectConsonance < HeadMusic::Style::Annotation
  def message
    'End on the tonic or a perfect consonance above the tonic.'
  end

  def marks
    if last_note && !ends_on_perfect_consonance?
      HeadMusic::Style::Mark.for(last_note)
    end
  end

  private

  def ends_on_perfect_consonance?
    functional_interval.perfect_consonance?(:two_part_harmony)
  end

  def functional_interval
    HeadMusic::FunctionalInterval.new(composition.key_signature.tonic_spelling, last_note.spelling)
  end

  def last_note
    notes.last
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
head_music-0.11.9 lib/head_music/style/annotations/end_on_perfect_consonance.rb