Class: Note
Instance Attribute Summary collapse
-
#dur ⇒ Object
readonly
Returns the value of attribute dur.
-
#note ⇒ Object
readonly
Returns the value of attribute note.
-
#octave ⇒ Object
readonly
Returns the value of attribute octave.
-
#velocity ⇒ Object
readonly
Returns the value of attribute velocity.
Instance Method Summary collapse
- #get_off_event(key) ⇒ Object
- #get_on_event(key) ⇒ Object
-
#initialize(degree, octave, velocity, dur) ⇒ Note
constructor
A new instance of Note.
- #inspect(key = nil) ⇒ Object
Constructor Details
#initialize(degree, octave, velocity, dur) ⇒ Note
Returns a new instance of Note.
18 19 20 21 22 23 |
# File 'lib/kuromusic/Track/Measure/Chord/Note.rb', line 18 def initialize(degree, octave, velocity, dur) @degree = degree @octave = octave @dur = dur @velocity = velocity end |
Instance Attribute Details
#dur ⇒ Object (readonly)
Returns the value of attribute dur.
4 5 6 |
# File 'lib/kuromusic/Track/Measure/Chord/Note.rb', line 4 def dur @dur end |
#note ⇒ Object (readonly)
Returns the value of attribute note.
4 5 6 |
# File 'lib/kuromusic/Track/Measure/Chord/Note.rb', line 4 def note @note end |
#octave ⇒ Object (readonly)
Returns the value of attribute octave.
4 5 6 |
# File 'lib/kuromusic/Track/Measure/Chord/Note.rb', line 4 def octave @octave end |
#velocity ⇒ Object (readonly)
Returns the value of attribute velocity.
4 5 6 |
# File 'lib/kuromusic/Track/Measure/Chord/Note.rb', line 4 def velocity @velocity end |
Instance Method Details
#get_off_event(key) ⇒ Object
30 31 32 33 |
# File 'lib/kuromusic/Track/Measure/Chord/Note.rb', line 30 def get_off_event(key) gdeg, goct = get_gdeg_and_goct(key) Event::Note::off(Key::degree_to_key(gdeg), goct) end |
#get_on_event(key) ⇒ Object
25 26 27 28 |
# File 'lib/kuromusic/Track/Measure/Chord/Note.rb', line 25 def get_on_event(key) gdeg, goct = get_gdeg_and_goct(key) Event::Note::on(Key::degree_to_key(gdeg), goct, @velocity) end |
#inspect(key = nil) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/kuromusic/Track/Measure/Chord/Note.rb', line 35 def inspect(key = nil) if key.nil? "<:degree=>" + @degree.to_s + ", :octave=>" + @octave.to_s + ", :velocity:=>" + @velocity.to_s + ", :duration=>" + @dur.to_s + ">" else gdeg, goct = get_gdeg_and_goct(key) "<:note=>" + Key::degree_to_key(gdeg) + ", :octave=>" + goct.to_s + ", :velocity:=>" + @velocity.to_s + ", :duration=>" + @dur.to_s + ">" end end |