Class: HeadMusic::Style::Guidelines::WeakBeatDissonanceTreatment

Inherits:
Annotation
  • Object
show all
Includes:
DissonanceFigureDetection
Defined in:
lib/head_music/style/guidelines/weak_beat_dissonance_treatment.rb

Overview

A counterpoint guideline

Constant Summary collapse

MESSAGE =
"Use only passing tones for dissonances on the weak beat."

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from HeadMusic::Style::Annotation

Instance Method Details

#all_consonant_with_cantus?(*checked_notes) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Returns:

  • (Boolean)

#cambiata_as_note_2?(index) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Returns:

  • (Boolean)

#cambiata_dissonance?(note) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Nota cambiata: a five-note figure where note 2 is dissonant, approached by step from note 1, leaps a third in the same direction to note 3, then notes 3-4-5 proceed stepwise in the opposite direction. Notes 1, 3, and 5 must be consonant with the CF.

Returns:

  • (Boolean)

#cambiata_shape?(n1, n2, n3, n4, n5) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Returns:

  • (Boolean)

#cantus_firmus_positionsObject (private) Originally defined in module DissonanceFigureDetection

Positions where the cantus firmus sounds a note (the strong beats).

#consonant_with_cantus?(note) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Returns:

  • (Boolean)

#dissonant_weak_beat_notesObject (private)



24
25
26
# File 'lib/head_music/style/guidelines/weak_beat_dissonance_treatment.rb', line 24

def dissonant_weak_beat_notes
  weak_beat_notes.select { |note| dissonant_with_cantus?(note) }
end

#dissonant_with_cantus?(note) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

A note whose pitch clashes with the cantus firmus in two-part harmony.

Returns:

  • (Boolean)

#double_neighbor_figure?(index, offset:) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Double neighbor: a four-note figure within one bar. Beats 1 and 4 are the same pitch (consonant), beats 2 and 3 are upper and lower neighbors connected by a leap of a third.

Returns:

  • (Boolean)

#double_neighbor_member?(note) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Returns:

  • (Boolean)

#double_neighbor_shape?(n1, n2, n3, n4) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Returns:

  • (Boolean)

#downbeat_position?(position) ⇒ Boolean (private)

Returns:

  • (Boolean)


32
33
34
# File 'lib/head_music/style/guidelines/weak_beat_dissonance_treatment.rb', line 32

def downbeat_position?(position)
  cantus_firmus_positions.include?(position.to_s)
end

#marksObject



10
11
12
13
14
15
16
# File 'lib/head_music/style/guidelines/weak_beat_dissonance_treatment.rb', line 10

def marks
  return [] unless cantus_firmus&.notes&.any?

  dissonant_weak_beat_notes.reject { |note| recognized_figure?(note) }.map do |note|
    HeadMusic::Style::Mark.for(note)
  end
end

#melodic_interval_between(note1, note2) ⇒ Object (private) Originally defined in module DissonanceFigureDetection

#neighbor_tone?(note) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Returns:

  • (Boolean)

#passing_tone?(note) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Returns:

  • (Boolean)

#recognized_figure?(note) ⇒ Boolean (private)

Returns:

  • (Boolean)


20
21
22
# File 'lib/head_music/style/guidelines/weak_beat_dissonance_treatment.rb', line 20

def recognized_figure?(note)
  passing_tone?(note)
end

#steps_back_from?(leap, step_back_1, step_back_2) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Notes 3-4-5 must both step in the direction opposite the leap.

Returns:

  • (Boolean)

#stepwise_figure?(note, same_direction:) ⇒ Boolean (private) Originally defined in module DissonanceFigureDetection

Returns:

  • (Boolean)

#weak_beat_notesObject (private)



28
29
30
# File 'lib/head_music/style/guidelines/weak_beat_dissonance_treatment.rb', line 28

def weak_beat_notes
  notes.reject { |note| downbeat_position?(note.position) }
end