class Vissen::Input::Message::Note

From the MIDI Association:

> Note On event. > This message is sent when a note is depressed (start).

> Note Off event. > This message is sent when a note is released (ended).

Constants

NOTE_OFF

Note On specifies the value of the lowest status bit for note off messages.

NOTE_ON

Note On specifies the value of the lowest status bit for note on messages.

STATUS

@see Message

STATUS_MASK

@see Message

Public Class Methods

create(*bytes, on: true, **args) click to toggle source

@param bytes (see Base.create) @param on [true, false] true if the note should be depressed,

otherwise false.

@param args (see Base.create) @return [Note]

Calls superclass method Vissen::Input::Message::Base::create
# File lib/vissen/input/message/note.rb, line 53
def create(*bytes, on: true, **args)
  super(*bytes, status: STATUS + (on ? NOTE_ON : NOTE_OFF), **args)
end

Public Instance Methods

note() click to toggle source

@return [Integer] the note value.

# File lib/vissen/input/message/note.rb, line 28
def note
  data[1]
end
off?() click to toggle source

@return [true, false] true if the note was released.

# File lib/vissen/input/message/note.rb, line 38
def off?
  (data[0] & NOTE_ON).zero?
end
on?() click to toggle source

@return [true, false] true if the note was depressed.

# File lib/vissen/input/message/note.rb, line 43
def on?
  !off?
end
velocity() click to toggle source

@return [Integer] the velocity value.

# File lib/vissen/input/message/note.rb, line 33
def velocity
  data[2]
end