class Vissen::Input::Message::PitchBendChange
From the MIDI Association:
> This message is sent to indicate a change in the pitch bender (wheel > or lever, typically). The pitch bender is measured by a fourteen bit > value. Center (no pitch change) is 2000H. Sensitivity is a function of > the receiver, but may be set using RPN 0.
Constants
- CENTER_VALUE
Center value is defined as the the offset that should be removed from the 14 bit pitch bend value to center it around zero.
- STATUS
@see
Message
Public Class Methods
create(value = 0.0, **args)
click to toggle source
TODO: Check the range on value.
@param value [Float] the pitch bend value in the range (-1..1). @param args (see Base.create
) @return [PitchBendChange]
Calls superclass method
Vissen::Input::Message::Base::create
# File lib/vissen/input/message/pitch_bend_change.rb, line 36 def create(value = 0.0, **args) bin_value = (value.to_f * CENTER_VALUE).round + CENTER_VALUE super(bin_value & 0xFF, bin_value >> 7, **args) end
Public Instance Methods
raw()
click to toggle source
@return [Integer] the integer pitch bend value.
# File lib/vissen/input/message/pitch_bend_change.rb, line 21 def raw (data[2] << 7) + data[1] - CENTER_VALUE end
value()
click to toggle source
@return [Float] the pitch bend value normalized to the range (-1..1).
# File lib/vissen/input/message/pitch_bend_change.rb, line 26 def value raw.to_f / CENTER_VALUE end