Find to which midi CC a parameter is mapped to

Hi,

I would like to know if there is a way to find to which midi CC a parameter is mapped to. From the API, I found that:

parameter has a custom MIDI mapping in the current song.

renoise.song().tracks[].devices[].parameters[].is_midi_mapped, _observable
-> [read-only, boolean]

however I did not found a way to find which CC it was…

Thanks

The MIDI CC value is given by the controls of your MIDI controller device (knob, fader, button …).

  1. Go to Renoise / MIDI Tab.
  2. Display the “Monitor” panel. In Data you will find the sysex shipments (6 digits). In “Subtype” you will find, among other things, the CC values.

To each parameter of each device of each track you can assign a specific control of your hardware MIDI controller device (knob, fader, button), with its specific CC send, and it depends on it.

In fact this is global, for the MIDI mapping of all Renoise.

Sorry for being unclear.

I’m trying to get this value via the scripting language in Lua, not in the interface

AFAIK, the API documentation does not refer to CC anywhere.
To control MIDI messages sent from a MIDI interface (a MIDI pad or a MIDI controller keyboard), it is possible to do so with sysex data (MIDI In and MIDI Out). You can play with this.

The sysex data are 3 2-digit values in hexadecimal notation. Here is an excerpt from my tool: New tool (3.2.0): Arturia KeyLab mkII v1.1 build 017 (August 2019)

local AKM_LOCK_IO_DEVICES=true
local AKM_INPUTS={}
local AKM_MIDI_DEVICE_IN=nil
local function akm_input_midi(in_device_name)
  if not table.is_empty(AKM_INPUTS) then
    if (in_device_name==nil) then
      if (AKM_MIDI_DEVICE_IN and AKM_MIDI_DEVICE_IN.is_open) then AKM_MIDI_DEVICE_IN:close() end
      return
    else
      local function midi_callback(message)
        assert(#message==3)
        assert(message[1]>=00 and message[1]<=0xFF)
        assert(message[2]>=00 and message[2]<=0xFF)
        assert(message[3]>=00 and message[3]<=0xFF)
        print(("%X %X %X || %s"):format(message[1],message[2],message[3],in_device_name))
      end
      if (AKM_MIDI_DEVICE_IN and AKM_MIDI_DEVICE_IN.is_open) then
        return
      else
        AKM_MIDI_DEVICE_IN=renoise.Midi.create_input_device(in_device_name,midi_callback)
      end
    end
  end
end

local function akm_check_midi_on()
  --AKM_INPUTS=renoise.Midi.available_input_devices()
  for i=1,#renoise.Midi.available_input_devices() do
    AKM_INPUTS[i]=(" %s"):format(renoise.Midi.available_input_devices()[i])
  end
  
  --[[
  if not table.is_empty(AKM_INPUTS) then
    vws.AKM_PP_DEVICE_IN.items=AKM_INPUTS
  end
  local function show_mess()
    AKM_ON_OFF=true akm_on_off()
    if (vws.AKM_PP_DEVICE_NAME.value==1) then
      return rna:show_warning("AKM: The in device \"MIDIIN2 (KeyLab mkII 49)\" is not conected!\n\n"
                            .."Do you have the \"KeyLab mkII 49\" MIDI controller\nconnected correctly?")
    end
    if (vws.AKM_PP_DEVICE_NAME.value==2) then
      return rna:show_warning("AKM: The in device \"MIDIIN2 (KeyLab mkII 61)\" is not conected!\n\n"
                            .."Do you have the \"KeyLab mkII 61\" MIDI controller\nconnected correctly?")
    end
    if (vws.AKM_PP_DEVICE_NAME.value==3) then
      return rna:show_warning("AKM: The in device \"MIDIIN2 (KeyLab mkII 88)\" is not conected!\n\n"
                            .."Do you have the \"KeyLab mkII 88\" MIDI controller\nconnected correctly?")
    end
  end
  ]]
  if (AKM_LOCK_IO_DEVICES) then
    --selecte default number of in device
    local in_device_name=AKM_INPUTS[1]
    --print("AKM dev_in:",vws.AKM_PP_DEVICE_IN.value,in_device_name)
    --AKM_ACTIVATE=true
    akm_input_midi(string.sub(in_device_name,2))
  end
end
akm_check_midi_on()

(You can copy this code in TestPad.lua and execute it there to try).

This code is lightened to work, but it is an excerpt from this tool. Can you see the entire LUA code after installing the tool? (Note: this tool will not work if you do not have the original device, an Arturia Keylab mkII)

The midi_callback(message) function With the midi_callback (message) function you can print incoming sysex messages. But first you must make sure that the “in_device_name” value (string) is available (the device is connected and bridged). The name of the device is exactly what appears here (device [1]):
image

By managing this data, you can make a tool react according to the hardware device.

I don’t know if there is any method to directly achieve incoming MIDI CC values through the API + LUA. But it would be interesting to know.

What exactly do you want CC values for? With the sysex data you can obtain the CC value, which corresponds to the second 2-digit value (message[2]). I believe.

Hi Raul,

Thank you for your suggestion. However this is not what I want to do. Basically I wanted to write a rule for Xrules that does exactly what Automapping does:

The only difference is that I want to have multiple targets for the incoming midi messages, and I wanted these targets to be the device parameters where the incoming midi CC messages are mapped to. So I could automate several, different device parameters at the same time and in real-time…

I don’t really want to write a tool for this but maybe I’ll have to…

In this case I suggest that you create your own tool on purpose if you know how to program. Working on other people’s code can be “very problematic.” In this way, you will have absolute control of the code.

Before that, I suggest you do behavior tests on Renoise. For example, you will not be able to record automation parameters in the pattern editor in two columns at once, if you use Renoise’s own automation through the tool. If you want to record parameters in 2 effect columns at the same time, it will be the tool itself who must do it directly, and this, unfortunately, is not in real time (you will have some delay of a few milliseconds, but fast enough for most reasonable cases.).