Class: MIDIMessage::Event::Note

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/midi-message/event/note.rb

Overview

an Event::Note is a pairing of a MIDI NoteOn and NoteOff message has a length that corresponds to sequencer ticks

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_message, duration, options = {}) ⇒ Note

Returns a new instance of Note.



20
21
22
23
24
25
# File 'lib/midi-message/event/note.rb', line 20

def initialize(start_message, duration, options = {})
  @start = start_message
  @length = duration

  @finish = options[:finish] || start_message.to_note_off
end

Instance Attribute Details

#finishObject (readonly)

Returns the value of attribute finish.



12
13
14
# File 'lib/midi-message/event/note.rb', line 12

def finish
  @finish
end

#lengthObject (readonly) Also known as: duration

Returns the value of attribute length.



12
13
14
# File 'lib/midi-message/event/note.rb', line 12

def length
  @length
end

#startObject (readonly)

Returns the value of attribute start.



12
13
14
# File 'lib/midi-message/event/note.rb', line 12

def start
  @start
end