Send MIDI channel pressure (aftertouch) message

midi_channel_pressure  val (midi)

Sends a MIDI channel pressure (aftertouch) message to all connected devices on all channels. Use the port: and channel: opts to restrict which MIDI ports and channels are used.

The pressure value 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.

You may also optionally pass the pressure value as a floating point value between 0 and 1 such as 0.2 or 0.785 (which will be mapped to MIDI values between 0 and 127) using the val_f: opt.

MIDI 1.0 Specification - Channel Voice Messages - Channel Pressure (Aftertouch)

Introduced in v3.0

Options

channel:

Channel(s) to send to

port:

MIDI port(s) to send to

value:

Pressure value as a MIDI number.

val_f:

Pressure value as a value between 0 and 1 (will be converted to a MIDI value)

on:

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

Examples

# Example 1

midi_channel_pressure 50 



#=> Sends MIDI channel pressure message with value 50 to all ports and channels



# Example 2

midi_channel_pressure :C4 



#=> Sends MIDI channel pressure message with value 60 to all ports and channels



# Example 3

midi_channel_pressure 0.5 



#=> Sends MIDI channel pressure message with value 63.5 to all ports and channels



# Example 4

midi_channel_pressure 30, channel: [1, 5] 



#=> Sends MIDI channel pressure message with value 30 on channel 1 and 5 to all ports