Performance drops when using MIDI device

Hi! I still have mostly the same problem, searching for a solution, and it seems that for Version 2.1.46 of widgets (or some other specifics) it doesn’t work.

I made an interface for a midi controller using 56 widgets (knobs, vertical and momentary) by replicating them several times.

Problems:

  1. Using direct midi binding inside the .toe I get significant fps drop (60->15) when interacting with physical elements.
  2. Using touchOut-touchIn TCP (2 .toe instances) with binding I get a constant drop (60->22).

Probe shows that the most consuming elements are:
launch_control_xl/ui/column1/

In all replicated Knobs:

  1. block1/knob1/overlay COMP
  2. block1/knob1/knob0/knobWidgetShader GLSL TOP
  3. block1/knob1/knob0/knobRotateScale DAT

In all replicated Vertical sliders:
4. block2/sliderVert/overlay COMP
5. block2/sliderVert/numericValue0/text (when Field Display turned off - doesn’t give a load)
6. block2/sliderVert/slider0/slider GLSL Multi TOP (+ flip TOP and over TOP nearby)

In all replicated Buttons:
7. block3/button1/overlay COMP
8. block3/button1/button0/text COMP

Testing the sketch with lfo channels results in the same frame drop as the TouchIn. Do you know what may be the reason for such slowdown?

LaunchControlXL_new.toe (3.0 MB)

1 Like

Hey @davinel000

It is likely that your whole UI is cooking, and this is triggered by one channel change.

The massive cooking in your example is not realistic right ? or you’d need many fingers to trigger all those Midi controls to change values at the same time ? :sweat_smile:

What you could try is add a Null CHOP with Selective cooking, after your Midi In CHOPs. See if that helps at all.

You could also try to use select CHOPs individually to break the CHOP into multiple “flows” and avoid having everything to cook.

For what I see after briefly looking at your sample file, the most effective, I think, would be to push the values that changed to the specific widgets using the python callback of the Bind CHOP. This would ensure that only the dedicated UI element is cooking, rather thant the whole UI.

Best,
Michel

2 Likes

Thank you very much for the suggestion!

A solution for not losing frames turned to be very short in callbacks:

ctrl = op(‘launch_control_xl’)

def onValueChange(bindOp, chan, val, prev, source):
ctrl.par[chan.name]=chan
return

Hey Michel @JetXS

Sorry to revive an old thread, but I still don’t get it. You can even see in Jarrett’s video he’s dropping frames when playing with his knobs towards the end: Widgets Part 10 - Advanced Binding - YouTube

Correct me if, but it feels too wrong to split the CHOP into 56 separate select and bind CHOPS - not even considering the midi controller has 8 pages…

I tried the callbacks code above but it crashed TD. Would you have any further clues on how to use the callbacks ?

No worries.

It shouldn’t crash TD ! Do you have a file that you can share where we can reproduce ? Do you have a .dmp file for us to look into ?

A tiny bit more recent than Jarrett’s tutorial is this inSession from a couple years ago where I actually cover some MIDI bits using a Bind CHOP and its callback.

Is it what you are after ?

I believe that if you go through our inSession playlist they were some other examples similar to the approach I take here.

They are a couple tips about optimization in that video as well.

Oh I think TD is actually crashing because of the errors generated when I turn my knobs.
The code in my callbacks must be wrong (I am not a very fluent coder).

Here is my file, I am using the same novation launch control. In the mean time I am checking the inSession, I think I skipped this one.
lcxl.toe (1.4 MB)

Ok I got it. Just had to:

  • use the strip() function to get corresponding parameters/channel names
  • remove the export from the bind CHOP to avoid a recursion error

Thanks for your help.

1 Like

Removing the export obviously breaks the Channel Pickup from the bind chop. I fixed it with this condition

if math.isclose(prev, [param name], rel_tol = 0.05, abs_tol = 0.01)

Lust gonna drop this here:

A pretty streight forward way of mapping midi-inputs to parameters without relying on binding.

1 Like