Making faders work in reverse

I wonder if anyone with more experience creating presets can help me.

I am struggling to work out how if there is a way to make one of my faders work in reverse. I am trying to make a preset for my Yamaha TG33. One of the parameters expects a MIDI value of 127 to correspond to 0 and value of 0 to correspond to 99, rather than both going up together. Is there a simple way to account for this in the JSON?

Here is the JSON I have written for the parameter if that helps:

[
“43”,
“10”,
“26”,
“02”,
“02”,
“00”,
“00”,
“09”,
“1”,
“7f”,
“00”,
{
“type”: “value”,
“rules”: [
{
“type”: “sysex”,
“parameterNumber”: 11,
“parameterBitPosition”: 0,
“byteBitPosition”: 0,
“bitWidth”: 7
}
]
}
]

Thanks

Is this a control from a fader on the E1 into the TG33 only? In other words it is not the TG33 that sends a value you want to E1 fader to respond to?
If it is only that, I’ll make you an example preset with such fader.

Yes thats right, just from the E1 to the synth.
That would be very kind, thanks so much!

I’ll look into it this weekend

1 Like

Check if this preset does what you look for (not a SysEx transmission but a CC transmission though).
https://app.electra.one/preset/M4ihuldZSRasuE2QtER7

The ‘inverse fader’ itself is a virtual one, running from 0 to 99. But it sends out its value from 99 to 0 as a CC number with the same parameternumber (in this case 12).
This is doen by ginve it the function “inverseValue” which then you need to program in lua:

deviceId = 1
device = devices.get(deviceId)
devPort = device:getPort()
channel = device:getChannel()

function inverseValue(valueObject,value) ---- converts 0 to 99 and vice versa
local message = valueObject:getMessage ()
local paramNum = message:getParameterNumber()
midi.sendControlChange (devPort, channel, paramNum, 99-value)
end

The first 4 lines is just to initialise the values needed to find the right port abd MIDI channel. This preset is assuming you assign your fader to the first device.

The function itself first looks up the message the valueObject wants to send, then looks for the paramterNumber in the message. Then it reconstructs a MIDI CC message with the desired value.

If you need a SysEx example, let me know.

Thanks very much for this.

Would I need to copy the lines you have written into the start of the JSON I have for the fader? And replace ‘ControlChange’ with ‘Sysex’?

I’m not sure what you mean by ‘lua’?

nope, that won’t work. My mistake.

By the way you answer, it’s clear the lua code is not yet your solution, as you need to address the TG33 via SysEx, not via CC, correct? It is indeed possible to add a function to a SysEx as well, but I need to test this, as I have not used a function in a SysEx json a lot myself.

I’ll come back to this in the weekend