Use pot touch to send a midi cc

Hey i know this have been asked many times but i can´t find out if its possible without writing Lua.

Can i use the pot touch to send a midi cc message ? and if yes how do i actually do it?

Sorry i am ultra noob with the E1 :smiley:

You’ll need lua for this.

But yes, you can have it send a midi CC message upon touching if that’s what you want. It’s using a subscription to touch events and a ‘onTouch’ callback that you can invoke when the pot is touched.

I myself haven’t done that yet.

Thx for the answer.. i was afraid it involved lua better learn the basics of it but is not so sharp at coding in general.. this might be the perfect reason to do it :slight_smile:

1 Like

Yes, the ‘onTouch’ callback is very useful and I have used it in my recent presets. I was switched on to it by @oldgearguy.

Here is a snippet of lua code from one of my recent presets (Electra One App). This is sending sysex rather than cc messages, but its the same basic idea.

-- events to track
events.subscribe(PAGES | POTS)

-- curCtl holds which of the control knobs were touched
-- only want to update after the control was changed and then released so
curCtl   = -1

-- control Ids ordered by parameter number (201-218)
patchCtls = {186,188,189,190,191,192,199,202,204,206,6}

msbIdx = 95 -- msb for SN Synth tones
lsbIdx = 64 -- lsb for SN synth tones: (64-70) for factory patches, and (0-3) for user banks

function events.onPotTouch(potId, controlId, touched)
  local idx = get_key_for_value(patchCtls,controlId)
  if (idx == nil) then return end

  if (touched == true) and (curCtl ~= controlId) then
      curCtl = controlId
  end
  if (touched == false) and (curCtl == controlId) then
    local midiValue = controls.get(controlId):getValue("value"):getMessage():getValue()
    local s = parameterMap.get (deviceId, PT_VIRTUAL, 10000 ) + 31
    local lsb = math.floor(midiValue / 128) + lsbIdx
    local midiValue = (midiValue % 128)
-- SNS patch select
    local array = {0x41, integra_ID, 0x00, 0x00, 0x64, 0x12, 0x18, 0x00, s, 0x06, msbIdx, lsb, midiValue, 0x7F}
    midi.sendSysex(port, array)
-- request SNS patch data
    local ab = SNAddress(1)
    array = {0x41, integra_ID, 0x00, 0x00, 0x64, 0x11, ab[1], ab[2], 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x7F}
    midi.sendSysex (port, array) 
  end
end
    
-- currently do not need to track which page is active; we might need it later
function events.onPageChange(newPageId, oldPageId)
   return
end

   
2 Likes

@kiwigrass thx a lot i will read thru this 100 times to see if i will learn something :smiley: i am really bad with code and have always wanted to understand at least basics..