Class: HeadMusic::Style::Guidelines::SustainAcrossBarlines

Inherits:
HeadMusic::Style::Guideline show all
Includes:
HeadMusic::Style::Guideline::BarSpan
Defined in:
lib/head_music/style/guidelines/sustain_across_barlines.rb

Overview

The syncopated texture of fourth species: the note sounding at a downbeat began before it. Judged over the voice's own bars rather than the cantus firmus's, so a solo line is held to it too. Notation-agnostic, so a whole note on beat three and a half tied to a half count the same.

Constant Summary collapse

MAX_BREAK_RATIO =
0.25

Instance Method Summary collapse

Constructor Details

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

Instance Method Details

#allowed_breaks ⇒ Object (private)



34
35
36
# File 'lib/head_music/style/guidelines/sustain_across_barlines.rb', line 34

def allowed_breaks
  (middle_bar_numbers.length * max_break_ratio).floor
end

#body_bar_numbers ⇒ Object (protected) Originally defined in module HeadMusic::Style::Guideline::BarSpan

#breaks ⇒ Object (private)

Fux allows the ligature to be dropped where none will fit, so a few breaks are free. Past that, every break is marked rather than only the ones past the allowance, so which bars a student sees flagged does not depend on where the free ones happened to fall.



30
31
32
# File 'lib/head_music/style/guidelines/sustain_across_barlines.rb', line 30

def breaks
  @breaks ||= middle_bar_numbers.reject { |bar_number| sustained_into?(bar_number) }
end

#downbeat_of(bar_number) ⇒ Object (protected) Originally defined in module HeadMusic::Style::Guideline::BarSpan

#first_bar_number ⇒ Object (protected) Originally defined in module HeadMusic::Style::Guideline::BarSpan

#last_bar_number ⇒ Object (protected) Originally defined in module HeadMusic::Style::Guideline::BarSpan

#mark_bar(bar_number) ⇒ Object (protected) Originally defined in module HeadMusic::Style::Guideline::BarSpan

#marks ⇒ Object



13
14
15
16
17
18
# File 'lib/head_music/style/guidelines/sustain_across_barlines.rb', line 13

def marks
  return [] if notes.empty?
  return [] if breaks.length <= allowed_breaks

  breaks.map { |bar_number| mark_bar(bar_number) }
end

#max_break_ratio ⇒ Object (private)



22
23
24
# File 'lib/head_music/style/guidelines/sustain_across_barlines.rb', line 22

def max_break_ratio
  options.fetch(:max_break_ratio) { self.class::MAX_BREAK_RATIO }
end

#middle_bar_numbers ⇒ Object (protected) Originally defined in module HeadMusic::Style::Guideline::BarSpan

#notes_in_bar(bar_number) ⇒ Object (protected) Originally defined in module HeadMusic::Style::Guideline::BarSpan

#sustained_into?(bar_number) ⇒ Boolean (private)

Returns:

  • (Boolean)


38
39
40
41
42
# File 'lib/head_music/style/guidelines/sustain_across_barlines.rb', line 38

def sustained_into?(bar_number)
  downbeat = downbeat_of(bar_number)
  held = voice.note_at(downbeat)
  !held.nil? && held.position < downbeat
end