Sha256: ca34dde7f303fac6f5adc0a0995b72563d91cbfe0393e6065e4be692bed37659

Contents?: true

Size: 640 Bytes

Versions: 6

Compression:

Stored size: 640 Bytes

Contents

module HeadMusic::Style::Annotations
end

class HeadMusic::Style::Annotations::Diatonic < HeadMusic::Style::Annotation
  MESSAGE = "Use only notes in the key signature."

  def marks
    HeadMusic::Style::Mark.for_each(notes_not_in_key_excluding_penultimate_leading_tone)
  end

  private

  def notes_not_in_key_excluding_penultimate_leading_tone
    notes_not_in_key.reject do |note|
      penultimate_note &&
      note == penultimate_note &&
      HeadMusic::ScaleDegree.new(key_signature, note.pitch.spelling).accidental == '#'
    end
  end

  def penultimate_note
    voice.note_preceding(positions.last) if positions.last
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
head_music-0.16.2 lib/head_music/style/annotations/diatonic.rb
head_music-0.16.0 lib/head_music/style/annotations/diatonic.rb
head_music-0.14.8 lib/head_music/style/annotations/diatonic.rb
head_music-0.14.7 lib/head_music/style/annotations/diatonic.rb
head_music-0.14.5 lib/head_music/style/annotations/diatonic.rb
head_music-0.14.4 lib/head_music/style/annotations/diatonic.rb