Class: PocketMiku::Note
Direct Known Subclasses
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#length ⇒ Object
Returns the value of attribute length.
-
#pitchbend ⇒ Object
Returns the value of attribute pitchbend.
-
#sound ⇒ Object
Returns the value of attribute sound.
-
#velocity ⇒ Object
Returns the value of attribute velocity.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Note
constructor
Args [options] - sound :: 発音する文字テーブルコード - key :: 音程 (0-127) - velocity :: 強さ (0-127) - pitchvend :: ピッチベンド - length :: 音の長さ(相対).
- #to_a ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Note
Args
- options
- sound
-
発音する文字テーブルコード
- key
-
音程 (0-127)
- velocity
-
強さ (0-127)
- pitchvend
-
ピッチベンド
- length
-
音の長さ(相対)
14 15 16 17 18 19 20 |
# File 'lib/pocket_miku/note.rb', line 14 def initialize(={}) self.sound = [:sound] self.key = [:key] self.velocity = [:velocity] self.pitchbend = [:pitchbend] self.length = [:length] end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
5 6 7 |
# File 'lib/pocket_miku/note.rb', line 5 def key @key end |
#length ⇒ Object
Returns the value of attribute length.
5 6 7 |
# File 'lib/pocket_miku/note.rb', line 5 def length @length end |
#pitchbend ⇒ Object
Returns the value of attribute pitchbend.
5 6 7 |
# File 'lib/pocket_miku/note.rb', line 5 def pitchbend @pitchbend end |
#sound ⇒ Object
Returns the value of attribute sound.
5 6 7 |
# File 'lib/pocket_miku/note.rb', line 5 def sound @sound end |
#velocity ⇒ Object
Returns the value of attribute velocity.
5 6 7 |
# File 'lib/pocket_miku/note.rb', line 5 def velocity @velocity end |
Instance Method Details
#to_a ⇒ Object
26 27 28 29 |
# File 'lib/pocket_miku/note.rb', line 26 def to_a [0xF0, 0x43, 0x79, 0x09, 0x11, 0x0A, 0, sound, 0xF7, 0x90, key, velocity] end |
#to_h ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/pocket_miku/note.rb', line 31 def to_h { sound: sound, key: key, velocity: velocity, pitchbend: pitchbend, length: length } end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/pocket_miku/note.rb', line 22 def to_s PocketMiku::PacketFactory.pack(to_a) end |