midi: add key pressure and channel pressure
This commit is contained in:
parent
c6a7d34e90
commit
9d09d055c6
3 changed files with 37 additions and 2 deletions
|
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
## next
|
||||
|
||||
- midi
|
||||
- added support for channel pressure and key pressure messages
|
||||
|
||||
## 1.0.4
|
||||
|
||||
- bug fixes
|
||||
|
|
|
|||
|
|
@ -69,3 +69,25 @@ System exclusive message.
|
|||
|
||||
- `msg`: hexadecimal sysex data string of the form `f0 ... f7`. You may include placeholders of the form `nn` which will be replaced by `v1, .., vN` respectively.
|
||||
- `v1, .., vN`: values encoded as hexadecimal data strings to include in `msg`. Most probably, you will need to sepcify a [custom module](/docs/custom-module/) in order to convert numeric widget values into the required hexadecimal format. In general, this conversion will be different for each manufacturer / device.
|
||||
|
||||
----
|
||||
|
||||
#### `/channel_pressure channel pressure`
|
||||
|
||||
Channel pressure event.
|
||||
|
||||
- `channel`: integer between 1 and 16
|
||||
- `pressure`: integer between 0 and 127
|
||||
|
||||
----
|
||||
|
||||
|
||||
#### `/key_pressure channel note pressure`
|
||||
|
||||
Polyphonic key pressure event.
|
||||
|
||||
- `channel`: integer between 1 and 16
|
||||
- `note`: integer between 0 and 127
|
||||
- `pressure`: integer between 0 and 127
|
||||
|
||||
----
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ MIDI_TO_OSC = {
|
|||
CONTROL_CHANGE: '/control',
|
||||
PROGRAM_CHANGE: '/program',
|
||||
PITCH_BEND: '/pitch',
|
||||
SYSTEM_EXCLUSIVE: '/sysex'
|
||||
SYSTEM_EXCLUSIVE: '/sysex',
|
||||
CHANNEL_PRESSURE: '/channel_pressure',
|
||||
POLY_PRESSURE: '/key_pressure'
|
||||
}
|
||||
|
||||
OSC_TO_MIDI = {
|
||||
|
|
@ -14,7 +16,9 @@ OSC_TO_MIDI = {
|
|||
'/control': CONTROL_CHANGE,
|
||||
'/program': PROGRAM_CHANGE,
|
||||
'/pitch': PITCH_BEND,
|
||||
'/sysex': SYSTEM_EXCLUSIVE
|
||||
'/sysex': SYSTEM_EXCLUSIVE,
|
||||
'/channel_pressure': CHANNEL_PRESSURE,
|
||||
'/key_pressure': POLY_PRESSURE
|
||||
}
|
||||
|
||||
def midi_str(message):
|
||||
|
|
@ -43,6 +47,10 @@ def midi_str(message):
|
|||
s = 'PROGRAM_CHANGE: channel=%i, program=%i' % (channel, message[1])
|
||||
elif mtype == PITCH_BEND:
|
||||
s = 'PITCH_BEND: channel=%i, pitch=%i' % (channel, message[1] + message[2] * 128 if len(message) == 3 else message[1])
|
||||
elif mtype == CHANNEL_PRESSURE:
|
||||
s = 'CHANNEL_PRESSURE: channel=%i, pressure=%i' % (channel, message[1])
|
||||
elif mtype == POLY_PRESSURE:
|
||||
s = 'KEY_PRESSURE: channel=%i, note=%i, pressure=%i' % (channel, message[1], message[2])
|
||||
|
||||
except IndexError:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue