Sha256: 8da6ccdae6f4a910d9c8386736b0d2bd6e14fcf0a92b27c6cf608b6a178aee0d

Contents?: true

Size: 701 Bytes

Versions: 9

Compression:

Stored size: 701 Bytes

Contents

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

# A counterpoint guideline
class HeadMusic::Style::Guidelines::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).alteration == "#"
    end
  end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
head_music-7.0.5 lib/head_music/style/guidelines/diatonic.rb
head_music-7.0.4 lib/head_music/style/guidelines/diatonic.rb
head_music-7.0.3 lib/head_music/style/guidelines/diatonic.rb
head_music-7.0.2 lib/head_music/style/guidelines/diatonic.rb
head_music-7.0.1 lib/head_music/style/guidelines/diatonic.rb
head_music-7.0.0 lib/head_music/style/guidelines/diatonic.rb
head_music-6.0.1 lib/head_music/style/guidelines/diatonic.rb
head_music-6.0.0 lib/head_music/style/guidelines/diatonic.rb
head_music-5.0.0 lib/head_music/style/guidelines/diatonic.rb