class HeadMusic::Note
A note is a pitch with a duration.
Note
quacks like a placement, but requires a different set of construction arguments
- always has a pitch - receives a voice and position if unspecified
Attributes
pitch[RW]
position[RW]
rhythmic_value[RW]
voice[RW]
Public Class Methods
new(pitch, rhythmic_value, voice = nil, position = nil)
click to toggle source
# File lib/head_music/content/note.rb, line 11 def initialize(pitch, rhythmic_value, voice = nil, position = nil) @pitch = HeadMusic::Pitch.get(pitch) @rhythmic_value = HeadMusic::RhythmicValue.get(rhythmic_value) @voice = voice || HeadMusic::Voice.new @position = position || HeadMusic::Position.new(@voice.composition, '1:1') end
Public Instance Methods
method_missing(method_name, *args, &block)
click to toggle source
Calls superclass method
# File lib/head_music/content/note.rb, line 26 def method_missing(method_name, *args, &block) respond_to_missing?(method_name) ? placement.send(method_name, *args, &block) : super end
placement()
click to toggle source
# File lib/head_music/content/note.rb, line 18 def placement @placement ||= HeadMusic::Placement.new(voice, position, rhythmic_value, pitch) end
respond_to_missing?(method_name, *_args)
click to toggle source
# File lib/head_music/content/note.rb, line 30 def respond_to_missing?(method_name, *_args) placement.respond_to?(method_name) end
to_s()
click to toggle source
# File lib/head_music/content/note.rb, line 22 def to_s "#{pitch} at #{position}" end