Class: Midi_interface
- Inherits:
-
Object
- Object
- Midi_interface
- Defined in:
- lib/melody_object/midi_interface.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize ⇒ Midi_interface
constructor
A new instance of Midi_interface.
- #note_off(note, channel, velocity) ⇒ Object
- #note_on(note, channel, velocity) ⇒ Object
Constructor Details
#initialize ⇒ Midi_interface
Returns a new instance of Midi_interface.
7 8 9 10 11 |
# File 'lib/melody_object/midi_interface.rb', line 7 def initialize @output=UniMIDI::Output.open(0) end |
Instance Attribute Details
#output ⇒ Object
Returns the value of attribute output.
5 6 7 |
# File 'lib/melody_object/midi_interface.rb', line 5 def output @output end |
Instance Method Details
#note_off(note, channel, velocity) ⇒ Object
20 21 22 23 24 |
# File 'lib/melody_object/midi_interface.rb', line 20 def note_off(note,channel,velocity) @output.puts(0x80|channel, note, velocity) # note on end |
#note_on(note, channel, velocity) ⇒ Object
13 14 15 16 17 |
# File 'lib/melody_object/midi_interface.rb', line 13 def note_on(note,channel,velocity) @output.puts(0x90|channel, note, velocity) # note on end |