Class: HeadMusic::Style::Guidelines::StepDownToFinalNote
- Inherits:
-
Annotation
- Object
- Annotation
- HeadMusic::Style::Guidelines::StepDownToFinalNote
show all
- Defined in:
- lib/head_music/style/guidelines/step_down_to_final_note.rb
Overview
Constant Summary
collapse
- MESSAGE =
"Step down to the final note."
Instance Method Summary
collapse
Instance Method Details
#descending? ⇒ Boolean
19
20
21
|
# File 'lib/head_music/style/guidelines/step_down_to_final_note.rb', line 19
def descending?
last_melodic_interval&.descending?
end
|
#last_melodic_interval ⇒ Object
27
28
29
|
# File 'lib/head_music/style/guidelines/step_down_to_final_note.rb', line 27
def last_melodic_interval
@last_melodic_interval ||= melodic_intervals.last
end
|
#marks ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/head_music/style/guidelines/step_down_to_final_note.rb', line 8
def marks
return if last_melodic_interval.nil?
fitness = 1
fitness *= HeadMusic::PENALTY_FACTOR unless step?
fitness *= HeadMusic::PENALTY_FACTOR unless descending?
HeadMusic::Style::Mark.for_all(notes[-2..], fitness: fitness) if fitness < 1
end
|
#step? ⇒ Boolean
23
24
25
|
# File 'lib/head_music/style/guidelines/step_down_to_final_note.rb', line 23
def step?
last_melodic_interval&.step?
end
|