class HeadMusic::Style::Guidelines::ConsonantClimax

A counterpoint guideline

Constants

MESSAGE

Public Instance Methods

marks() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 10
def marks
  HeadMusic::Style::Mark.for_each(highest_notes) unless adherent_climax?
end

Private Instance Methods

adherent_climax?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 16
def adherent_climax?
  descending_melody? ? adherent_low_pitch? : adherent_high_pitch?
end
adherent_high_pitch?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 20
def adherent_high_pitch?
  notes? && highest_pitch_consonant_with_tonic? &&
    (highest_pitch_appears_once? || highest_pitch_appears_twice_with_step_between?)
end
adherent_low_pitch?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 25
def adherent_low_pitch?
  notes? &&
    lowest_pitch_consonant_with_tonic? &&
    (lowest_pitch_appears_once? || lowest_pitch_appears_twice_with_step_between?)
end
descending_melody?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 106
def descending_melody?
  # account for the possibility of opening with an octave leap
  notes.length > 1 &&
    [first_note.pitch, second_note.pitch].include?(highest_pitch) &&
    highest_pitch.spelling == tonic_spelling
end
diatonic_interval_to_highest_pitch() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 39
def diatonic_interval_to_highest_pitch
  @diatonic_interval_to_highest_pitch ||=
    HeadMusic::DiatonicInterval.new(tonic_pitch, highest_pitch)
end
diatonic_interval_to_lowest_pitch() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 44
def diatonic_interval_to_lowest_pitch
  @diatonic_interval_to_lowest_pitch ||=
    HeadMusic::DiatonicInterval.new(tonic_pitch, lowest_pitch)
end
highest_pitch_appears_once?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 49
def highest_pitch_appears_once?
  highest_notes.length == 1
end
highest_pitch_appears_twice?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 69
def highest_pitch_appears_twice?
  highest_notes.length == 2
end
highest_pitch_appears_twice_with_step_between?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 57
def highest_pitch_appears_twice_with_step_between?
  highest_pitch_appears_twice? &&
    single_note_between_highest_notes? &&
    step_between_highest_notes?
end
highest_pitch_consonant_with_tonic?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 31
def highest_pitch_consonant_with_tonic?
  diatonic_interval_to_highest_pitch.consonance?(:melodic)
end
lowest_pitch_appears_once?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 53
def lowest_pitch_appears_once?
  lowest_notes.length == 1
end
lowest_pitch_appears_twice?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 73
def lowest_pitch_appears_twice?
  lowest_notes.length == 2
end
lowest_pitch_appears_twice_with_step_between?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 63
def lowest_pitch_appears_twice_with_step_between?
  lowest_pitch_appears_twice? &&
    single_note_between_lowest_notes? &&
    step_between_lowest_notes?
end
lowest_pitch_consonant_with_tonic?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 35
def lowest_pitch_consonant_with_tonic?
  diatonic_interval_to_lowest_pitch.consonance?(:melodic)
end
notes_between(edge_notes) click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 101
def notes_between(edge_notes)
  indexes = edge_notes.map { |note| notes.index(note) }
  notes[(indexes.first + 1)..(indexes.last - 1)] || []
end
notes_between_highest_notes() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 93
def notes_between_highest_notes
  notes_between(highest_notes)
end
notes_between_lowest_notes() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 97
def notes_between_lowest_notes
  notes_between(lowest_notes)
end
second_note() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 113
def second_note
  notes && notes[1]
end
single_note_between_highest_notes?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 85
def single_note_between_highest_notes?
  notes_between_highest_notes.length == 1
end
single_note_between_lowest_notes?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 89
def single_note_between_lowest_notes?
  notes_between_lowest_notes.length == 1
end
step_between_highest_notes?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 77
def step_between_highest_notes?
  HeadMusic::MelodicInterval.new(highest_notes.first, notes_between_highest_notes.first).step?
end
step_between_lowest_notes?() click to toggle source
# File lib/head_music/style/guidelines/consonant_climax.rb, line 81
def step_between_lowest_notes?
  HeadMusic::MelodicInterval.new(lowest_notes.first, notes_between_lowest_notes.first).step?
end