14-Bit Rotary Output using Arbitrary MSB CC

Hi. I need a controller that can output 14-bit values from a rotary where MSB will be either CC86 or CC97 and the LSB will be CCn, MSB has to be send before LSB for every rotary motion that outputs a 14-bit value. Can Electra One do this. Likely not out of the box - but how about with a LUA script? Thanks.

Hi this should be possible with a script. A preset can contain a Lua script. In this script you can add this listener for changes of controllers:

function parameterMap.onChange(valueObjects, origin, midiValue)

This lets you observe any change to the controls. You can then manually send out midi signals over the MIDI ports of the Electra One.

See here for the parameterMap documentation: Preset Lua extension | Electra One Documentation, and here for the MIDI functions for sending out data: Preset Lua extension | Electra One Documentation

That way you can verify if what you need gets covered by the API.

Great. Thanks for this information!! My use case will be talking to Haken Audio EaganMatrix for controlling the new Specialty Synth function applied to Haken Continuum devices and Expressive E Osmose.

Sounds great. Love the Osmose.

this also can be done by adding a control with 14-bit virtual message and linking a Lua function to it. The logic of the function should then send the LSB value with every value change. The MSB should be sent out only when LSB passes zero. Simplified Lua would be something like this:

local CONTROL_CHANGE_MSB_INC = 86
local CONTROL_CHANGE_MSB_DEC = 97
local DEVICE_PORT = PORT_1
local DEVICE_CHANNEL = 1

local prevValueMsb = 0

function sendCustomCc(valueObject, value)
    local valueMsb = value >> 7
    local valueLsb = value & 0x7f
    local controlChangeLsb = valueObject:getMessage():getParameterNumber()

    if valueMsb ~= prevValueMsb then
        midi.sendControlChange(
            DEVICE_PORT,
            DEVICE_CHANNEL,
            (valueMsb > prevValueMsb) and CONTROL_CHANGE_MSB_INC or CONTROL_CHANGE_MSB_DEC,
            valueMsb)
        prevValueMsb = valueMsb
    end

    midi.sendControlChange(DEVICE_PORT, DEVICE_CHANNEL, controlChangeLsb, valueLsb)
end

Custom 14-bit CC preset.

For a real-world preset, I would suggest getting the port and device out of the associated device and possibly using a Lua upvalue for prevValueMsb instead of the global.

1 Like

Wow. Thank you so much for taking the to show me this!

1 Like

Hi,
It’s not clear from the documentation how I get the (valueObject, value) assigned in the GUI config for Selected Object I assign sendCustomCC in the Function slot (I assume that is what is needed to assign functions to specific selected objects). Thanks!
image