Module: JSound::Midi::MessageBuilder

Defined in:
lib/jsound/midi/message_builder.rb

Overview

A collection of methods for building MIDI messages.

Instance Method Summary collapse

Instance Method Details

#all_notes_off(channel = 0) ⇒ Object



26
27
28
# File 'lib/jsound/midi/message_builder.rb', line 26

def all_notes_off(channel=0)
  control_change(123, 0, channel)
end

#channel_pressure(pressure, channel = 0) ⇒ Object Also known as: channel_aftertouch



30
31
32
# File 'lib/jsound/midi/message_builder.rb', line 30

def channel_pressure(pressure, channel=0)
  Messages::ChannelPressure.new(pressure, channel)
end

#control_change(control, value, channel = 0) ⇒ Object



22
23
24
# File 'lib/jsound/midi/message_builder.rb', line 22

def control_change(control, value, channel=0)
  Messages::ControlChange.new(control, value, channel)
end

#note_off(pitch, velocity = 127, channel = 0) ⇒ Object



11
12
13
# File 'lib/jsound/midi/message_builder.rb', line 11

def note_off(pitch, velocity=127, channel=0)
  Messages::NoteOff.new(pitch,velocity,channel)
end

#note_on(pitch, velocity = 127, channel = 0) ⇒ Object



7
8
9
# File 'lib/jsound/midi/message_builder.rb', line 7

def note_on(pitch, velocity=127, channel=0)
  Messages::NoteOn.new(pitch,velocity,channel)
end

#pitch_bend(value, channel = 0) ⇒ Object

Most methods in here take 7-bit ints for their args, but this one takes a 14-bit The value can be an int in the range 0-16383 (8192 is no bend) or it can be a float, which is assumed to be in the range -1.0 to 1.0



18
19
20
# File 'lib/jsound/midi/message_builder.rb', line 18

def pitch_bend(value, channel=0)
  Messages::PitchBend.new(value, channel)
end

#poly_pressure(pitch, pressure, channel = 0) ⇒ Object Also known as: poly_aftertouch



35
36
37
# File 'lib/jsound/midi/message_builder.rb', line 35

def poly_pressure(pitch, pressure, channel=0)
  Messages::PolyPressure.new(pitch, pressure, channel)
end

#program_change(program, channel = 0) ⇒ Object



40
41
42
# File 'lib/jsound/midi/message_builder.rb', line 40

def program_change(program, channel=0)
  Messages::ProgramChange.new(program, channel)
end