Followed the official Widgets tutorial and it causes massive frame drops

Really struggling with my midi-to-widget setup. Basically whenever I adjust anything in my UI (Whether by clicking or using a controller), there is a massive FPS drop, from 60 to 30. I’ve followed these videos and what’s interesting is that the when the instructor adjusts his knobs, he also has a massive FPS drop, so I think the issue may be his methods and maybe there should be an updated tutorial.

I managed to isolate the issue in this .toe. Simply try dragging a value in the “control” panel and you should see the performance hit:
midi-issues.toe (1.9 MB)

From looking at the performance monitor and probe, it looks like whenever a knob or button is used, EVERY node in the whole network cooks.

Thank you so much! I’ll take a look and log this now.

I tested the file, the issue i see if the same problem as in 2022 which we have not been able to address yet (though we have spent time on it) which is CHOPs do not have per-channel cooking dependancies yet. So if one CHOP channel changes they all ‘cook’.

While both of my machines didn’t drop many frames, (mac dropped nothing, windows dropped from 60 down to 57-58), I can see the whole UI cooking which each knob turn (using Tools > Probe from the Palette is good for this). I understand this is only the input and UI and leaves nothing for the rest of your project.

What you could do to alleviate this is separate the CHOPs pipelines for knobs and buttons. Then at least turn a knob would only cause your knobs UI to cook, and pressing a button isolated to button UI, etc. Just make identical networks, one for knobs, one for buttons, 2 Bind CHOPs.

We understand this is undesirable but the overhaul to cooking required to fix this has been a challenge and the project has been on and off due to other priorities.

1 Like

I don’t know how ugly or wrong is this, but here is how I did, and for me it seems to have worked. It comes from this related thread : https://forum.derivative.ca/t/performance-drops-when-using-midi-device

  • follow Jarret’s tutorial but
  • don’t put the bind CHOP, instead
  • just put a null CHOP and use a CHOP execute DAT with onValueChange to push the values to your UI COMP
ctrl = op('[INSERT UI COMP NAME HERE]')
def onValueChange(channel, sampleIndex, val, prev):

			ctrl.par[channel.name]=channel
	return

Now you need to fix channel pickup. For this I used python’s math.isclose

You can read it as “if the value is far from what is in the UI COMP, don’t do anything”

ctrl = op('[INSERT UI COMP NAME HERE]')
def onValueChange(channel, sampleIndex, val, prev):
	if math.isclose(ctrl.par[channel.name], channel, abs_tol = 0.25):
		if math.isclose(ctrl.par[channel.name], prev, abs_tol = 0.05): 	
			ctrl.par[channel.name]=channel
	return

I also had to fix the channel.name with strip() because I had a prefix on my channels.

I had to check twice if the value is close because in my show system I use a different UI comp for each scene, but with a single controler ; so if I move the controler on another scene “prev” remains where it was and is still close. If you put a too small value in abs_tol (stands for tolerance), when moving your midi controler quickly, it will leave the UI behind.

Now buttons are broken because they don’t need channel pickup. I just split it with two select CHOPS and added another execute DAT without the isclose conditions…

1 Like