I want to convert incoming MIDI-CC #20 to NRPN to control the cutoff of my Prophet VS.
I can see you’re splitting the CC message into multiple messages, to create an NRPN message.
I took a quick look, because the built-in NRPN message should be way more comfortable to use.
But it seems that (and this is probably what threw you off), there is a need to define the following
bit_depth = 14
(this really shouldn’t be necessary but also won’t hurt. In this particular case, it seems to make the NRPN message work as intended).
So the way I’d suggest it would be like this (3 steps)
- Define a ‘call_function’ that configures xRules to output 14-bit NRPN messages
message_type = 'nrpn'
bit_depth = 14
Of course, you could use the ‘set_message_type’ via the graphical UI too - the snippet above is basically just killing two birds with one stone.
If you need to change, scale values somehow, this can be done as simply as adding the following statements to the code snippet above:
values[1] = 200 -- Number: set to fixed value
values[2] = values[2]*2 -- Data: increase by x2
Splitting into the MSB/LSB parts are done automatically on output. In other words, the message is turned into this kind of message:
-- ### build NRPN message
-- 0xBX,0x63,0xYY (X = Channel, Y = NRPN Number MSB)
-- 0xBX,0x62,0xYY (X = Channel, Y = NRPN Number LSB)
-- 0xBX,0x06,0xYY (X = Channel, Y = Data Entry MSB)
-- 0xBX,0x26,0xYY (X = Channel, Y = Data Entry LSB)
-- TODO optionally, when 'terminate_nrpn' is specified...
-- 0xBX,0x65,0x7F (X = Channel)
-- 0xBX,0x64,0x7F (X = Channel)
-
Define which output port to use (‘set_port_name’).
-
Define the output method (‘output_message’ → ‘external_midi’)
Also, check if NRPN is enabled and that the desired output port has been enabled in Preferences > MIDI