Send MIDI program change message

midi_pc  program_num (midi)

Sends a MIDI program change message to all connected devices on all channels. Use the port: and channel: opts to restrict which MIDI ports and channels are used.

Program number can be passed as a note such as :e3 and decimal values will be rounded down or up to the nearest whole number - so values between 3.5 and 4 will be rounded up to 4 and values between 3.49999… and 3 will be rounded down to 3.

MIDI 1.0 Specification - Channel Voice Messages - Program change

Introduced in v3.0.2

Options

channel:

Channel(s) to send to

port:

MIDI port(s) to send to

on:

If specified and false/nil/0 will stop the midi pc message from being sent out. (Ensures all opts are evaluated in this call to midi_pc regardless of value).

Examples

# Example 1

midi_pc 100 



#=> Sends MIDI pc message to all ports and channels



# Example 2

midi_pc :e7 



#=> Sends MIDI pc message to all ports and channels



# Example 3

midi_pc 100, channel: 5 



#=> Sends MIDI pc message on channel 5 to all ports



# Example 4

midi_pc 100, channel: 5 



#=> Sends MIDI pc message on channel 5 to all ports



# Example 5

midi_pc 100, channel: [1, 5] 



#=> Sends MIDI pc message on channel 1 and 5 to all ports