Class: HeadMusic::Style::Guidelines::PreferLongBeforeShort

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

Overview

Two quarters opening a bar and a longer note closing it make a static point that blocks the flow into the next bar, unless the longer note ties over (Salzer and Schachter, p. 103). Fux marks the shape N.B. in figure 88.

Instance Method Summary collapse

Constructor Details

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

Instance Method Details

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

#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

#half_value ⇒ Object (private)



40
41
42
# File 'lib/head_music/style/guidelines/prefer_long_before_short.rb', line 40

def half_value
  HeadMusic::Rudiment::RhythmicValue.get(:half).total_value
end

#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



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

def marks
  return [] if notes.empty?

  (first_bar_number..last_bar_number).filter_map do |bar_number|
    opening = notes_in_bar(bar_number).first(3)
    HeadMusic::Style::Mark.for_all(opening) if static_point?(opening, bar_number)
  end
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

#static_point?(opening, bar_number) ⇒ Boolean (private)

Read from the notes' own positions rather than beat numbers, so a half beat in 3/2 is judged as a quarter beat is in 4/4.

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
33
34
# File 'lib/head_music/style/guidelines/prefer_long_before_short.rb', line 25

def static_point?(opening, bar_number)
  return false unless opening.length == 3

  first, second, third = opening
  first.position == downbeat_of(bar_number) &&
    undotted_quarter?(first) && undotted_quarter?(second) &&
    second.position == first.next_position && third.position == second.next_position &&
    third.rhythmic_value.total_value >= half_value &&
    third.next_position == downbeat_of(bar_number + 1)
end

#undotted_quarter?(note) ⇒ Boolean (private)

Returns:

  • (Boolean)


36
37
38
# File 'lib/head_music/style/guidelines/prefer_long_before_short.rb', line 36

def undotted_quarter?(note)
  note.rhythmic_value.unit_name == "quarter" && note.rhythmic_value.dots.zero?
end