Class: HeadMusic::Style::Guidelines::DirectionChanges

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

Overview

A melodic line should have direction changes.

Constant Summary

Constants inherited from Annotation

Annotation::MESSAGE

Instance Attribute Summary

Attributes inherited from Annotation

#voice

Instance Method Summary collapse

Methods inherited from Annotation

#adherent?, #end_position, #fitness, #initialize, #message, #notes?, #start_position

Constructor Details

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

Instance Method Details

#marksObject



6
7
8
9
10
11
# File 'lib/head_music/style/guidelines/direction_changes.rb', line 6

def marks
  return unless overage.positive?

  penalty_exponent = overage**0.5
  HeadMusic::Style::Mark.for_all(notes, fitness: HeadMusic::PENALTY_FACTOR**penalty_exponent)
end