uiCombo not responding to MIDI CC

Home Forums General Programming uiCombo not responding to MIDI CC

Tagged: ,

This topic contains 13 replies, has 2 voices, and was last updated by Possemo Possemo 23 hours, 20 minutes ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #83854
    lfo2vco
    lfo2vco
    Participant
    • Topics: 22
    • Replies: 140
    • Total: 162
    • ★★

    Hi there,

    So I’m still tinkering with my panel and have made some improvements and ironed out a few bugs. Now for completeness there is an issue I have noticed that would be good to address, it is as follows.

    When entering values on the synth Ctrlr uiSliders mirror those changes perfectly. However Ctrlr uiCombos do not!

    I am not referring to receiving tone edit Sysex dumps these work fine, the issue is with CC messages transmitted by the synth during parameter edits made via the synth.

    For example I have a uiCombo with three values in the Combo contents window, these are:
    16′
    8′
    4′

    The MIDI data for these is:

    $08 (08) $yy yy= $00-$1f (0-31)   16'
                     $20-$3f (32-63)  8'
                     $40-$7f (64-127) 4'

    So do I need amend the ‘Expression to evaluate when calculating modulator value from midi message value field’? Do I need to attach a method to the ‘Called to calculate new modulator value from midi value’ popup? I have fiddled around with both of these but not really knowing what I am doing all attempts failed.

    Any assistance is always appreciated.
    Thanks.

    #83861
    Possemo
    Possemo
    Participant
    • Topics: 12
    • Replies: 396
    • Total: 408
    • ★★

    I haven’t studied this problem so far but did you check what message the synth sends? E.g. when you entered in the Combo this:

    16’=0
    8’=32
    4’=64

    But the synth sends something different like 16’=31 it would be clear that it does not work. If it does not work for some reason I would try a script attached to “Called to calculate new modulator value from a MIDI value”. Here’s what the Lua editor makes when you add a new method selecting the right template:

    myNewMethod = function(–[[ CtrlrModulator –]] modulator, –[[ CtrlrMidiMessage –]] midiMessage, –[[ number –]] numericMidiValue)

    return numericMidiValue

    end

    #83918
    lfo2vco
    lfo2vco
    Participant
    • Topics: 22
    • Replies: 140
    • Total: 162
    • ★★

    Thanks Possemo,

    Indeed to your first point the synth actually returns:

    $54 (84) 16’
    $24 (36) 8’
    $00 (0) 4’

    To your second point I attached the script as suggested, however this had no effect.
    I will have a further dabble with scripts and see what I can achieve, I’ll report any kind of success.

    #83942
    Possemo
    Possemo
    Participant
    • Topics: 12
    • Replies: 396
    • Total: 408
    • ★★

    So the synth returns completely different values? The range seems to be upside down compared to your previous list.

    The script does not do anything, it is an empty template. You would have to enter code that converts the received values into the combo values. But I would first check if the synth really sends the wrong values. If it is a bug in the firmware there would be no other way than making a script that converts the wrong values into right ones.

    • This reply was modified 1 week, 5 days ago by Possemo Possemo.
    #83952
    lfo2vco
    lfo2vco
    Participant
    • Topics: 22
    • Replies: 140
    • Total: 162
    • ★★

    Oh dear, the joys of dyscalculia.

    My error that should have read:
    $00 (0) 16’
    $24 (36) 8’
    $54 (84) 4’

    So the synth firmware is fine, it is my firmware that is buggy!

    #83954
    Possemo
    Possemo
    Participant
    • Topics: 12
    • Replies: 396
    • Total: 408
    • ★★

    No problem, I have a touch of dyslexia and in school numbers were not my friends either but I am learning to live with it – now at the age of 49… he he.

    Well then, did you try to set the uiCombo to the same values as the ones the synth sends? The uiCombo is an awkward modulator with a couple of bugs. Maybe it just won’t react to incoming messages whatever you do. In this case my last resort would be to make a script. I will try to help you on that.

    #83961
    lfo2vco
    lfo2vco
    Participant
    • Topics: 22
    • Replies: 140
    • Total: 162
    • ★★

    Thanks Possemo,

    I too have Dyslexia, however as I child my next door neighbour was a teacher and I had one to one tuition which helped a lot. But I still have problems if I am flustered or in a hurry and sometimes I cannot connect the middle of a journey although I can picture both the start and the finish. However on the plus side it means I can often approach problem solving from a different angle.

    Well I tried adjusting the uiCombo values to match the synth values but with no avail, so I think the script route is best way forward.

    I have a script that recognises incoming CC, but I would like to omit the MIDI channel character from this. I tried using BigInteger and (bi:getBitRangeAsInt(1,1), but didn’t entirely know what I was doing.

    	midiCcID = midiMessage:getLuaData():getByte(0)
    	if midiCcID == 0xB0 then
    		console("CC Detected")
    
    	end

    I am guessing I need to make a script for each uiCombo and attach it via the “Called to calculate new modulator value from a MIDI value” menu. Would that be correct? As opposed to one long script for all.

    #83965
    Possemo
    Possemo
    Participant
    • Topics: 12
    • Replies: 396
    • Total: 408
    • ★★

    My idea for this problem would be as follows:

    Make a slider with the same midi cc. You can hide this slider or put it do a different layer and make the layer invisible. This one should react to the incoming midi cc, so you don’t have to deal with that in the script. Then add a script to this slider “when modulator value changes”. In this script you set the uiCombo accordingly when the slider gets the specific incoming values.

    #84092
    lfo2vco
    lfo2vco
    Participant
    • Topics: 22
    • Replies: 140
    • Total: 162
    • ★★

    That seems like a good workaround, I have quite a lot of uiCombos on my panel however. With this in mind I have persevered with Lua scripting with some success.

    So I have added the following to my ‘midiMessageReceived’ script which is attached to ‘Called when panels receives a MIDImessage’

    midiMessageReceived = function(midiMessage)
    
    	midiCcID = midiMessage:getData():getByte(0)
    	if midiCcID == 0xB0
    	or midiCcID == 0xB1
    	or midiCcID == 0xB2
    	or midiCcID == 0xB3
    	or midiCcID == 0xB4
    	or midiCcID == 0xB5
    	or midiCcID == 0xB6
    	or midiCcID == 0xB7
    	or midiCcID == 0xB8
    	or midiCcID == 0xB9
    	or midiCcID == 0xBA
    	or midiCcID == 0xBB
    	or midiCcID == 0xBC
    	or midiCcID == 0xBD
    	or midiCcID == 0xBE
    	or midiCcID == 0xBF then
    		console ("CC Detected")
    
    	end
    
    	midiCcMod = midiMessage:getData():getByte(1)
    	if midiCcMod == 0x08 then
    		dcoOneRangeMessage(midiMessage)
    
    	end
    
    end

    Then I have a method for each uiCombo that is scripted as per the following.

    dcoOneRangeMessage = function(midiMessage)
    
    	midiCcData = midiMessage:getData():getByte(2)
    	if midiCcData == 0x00 then
    		DCO1Range:setModulatorValue((0), false, false, false)
    	elseif midiCcData == 0x24 then
    		DCO1Range:setModulatorValue((1), false, false, false)
    	elseif midiCcData == 0x54 then
    		DCO1Range:setModulatorValue((2), false, false, false)
    
    	end
    
    end
    #84093
    Possemo
    Possemo
    Participant
    • Topics: 12
    • Replies: 396
    • Total: 408
    • ★★

    If you have lots of these uiCombos this is probably the the best way doing it. Instead of setModulatorValue you could use setValueMapped and assign the value directly:

    midiCcData = midiMessage:getData():getByte(2)
    DCO1Range:setValueMapped(midiCcData, false, false)

    But this has the disadvantage that the modulator will send the new CC value to MIDI-Out – usually you don’t want that to happen.

    #84095
    lfo2vco
    lfo2vco
    Participant
    • Topics: 22
    • Replies: 140
    • Total: 162
    • ★★

    Thanks for the info I will try setValueMapped tonight and see what the result is.

    Due to my lack of Lua knowledge I am not sure if the way I have formatted the first script is correct. In that I wish for it only to proceed to midiCcData = midiMessage:getData():getByte(2)
    if the result of
    midiCcID = midiMessage:getData():getByte(0)
    is positive. I have a suspicion that currently the second question is independent of the first.

    Could you confirm and or advise if this is the case please. Cheers.

    #84100
    Possemo
    Possemo
    Participant
    • Topics: 12
    • Replies: 396
    • Total: 408
    • ★★

    yea then you should include midiCcData in the first if-statement:

    midiMessageReceived = function(midiMessage)
    
    	midiCcID = midiMessage:getData():getByte(0)
    	if midiCcID == 0xB0
    	or midiCcID == 0xB1
    	or midiCcID == 0xB2
    	or midiCcID == 0xB3
    	or midiCcID == 0xB4
    	or midiCcID == 0xB5
    	or midiCcID == 0xB6
    	or midiCcID == 0xB7
    	or midiCcID == 0xB8
    	or midiCcID == 0xB9
    	or midiCcID == 0xBA
    	or midiCcID == 0xBB
    	or midiCcID == 0xBC
    	or midiCcID == 0xBD
    	or midiCcID == 0xBE
    	or midiCcID == 0xBF then
    		console ("CC Detected")
    
    	       midiCcMod = midiMessage:getData():getByte(1)
    	       if midiCcMod == 0x08 then
    		    dcoOneRangeMessage(midiMessage)
    	       end
    	end
    end

    the many “or’s” could be replaced by “greater or equal than” and “smaller or equal than”:

    midiMessageReceived = function(midiMessage)
    
    	midiCcID = midiMessage:getData():getByte(0)
    	if midiCcID >= 0xB0 and midiCcID <= 0xBF then
    
    		console ("CC Detected")
    
    	       midiCcMod = midiMessage:getData():getByte(1)
    	       if midiCcMod == 0x08 then
    		    dcoOneRangeMessage(midiMessage)
    	       end
    	end
    end

    I haven’t tested it but in theory it should work. Maybe it does not work with hex number but I wouldn’t see why. If it does not work for some weird reason you could use decimal numbers – replace 0xB0 with 176 and 0xBF with 191.

    #84101
    lfo2vco
    lfo2vco
    Participant
    • Topics: 22
    • Replies: 140
    • Total: 162
    • ★★

    Hey Possemo, that works brilliantly. I tested the >= and <= across all sixteen MIDI channels to be on the safe side and it works perfectly. Many thanks for your invaluable assistance.

    #84106
    Possemo
    Possemo
    Participant
    • Topics: 12
    • Replies: 396
    • Total: 408
    • ★★

    fine, one last thing I always do: remove the console output when you have finished debugging. the cosole() command slows down performance significantly. If you just send a fixed string like in your example it is probably not that bad but I would remove it anyway.

    • This reply was modified 23 hours, 20 minutes ago by Possemo Possemo.
Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.

There is currently 0 users and 11 guests online
No users are currently active
Forum Statistics
Threads: 2,120, Posts: 14,901, Members: 8,720
Most users ever online was 5 on March 28, 2018 6:11 pm
Do NOT follow this link or you will be banned from the site!