Edit: See my later post for the solution and patch.
TL;DR Are there any design patterns or strategies for updating lots of LED animations? Or, perhaps, does grid have a “FPS” limit?
Hey all. I’ve got a project I’m working on that involves lots of moving LEDs. There are “signals” that move about the grid and “cells” that are stationary, but the user can place them everywhere. There are submenus, multi-finger gestures, etc. This is an M4L device and, to my horror, when I turned on the Live playback everything started lagging horrendously. After I hit stop it took many seconds for the animations and redraws to catch up. Obviously not acceptable. I haven’t done a deep dive into finding the bottleneck but my first hypothesis is that I shouldn’t be clearing the whole grid and redrawing every LED for each beat… but the idea of intelligently tracking every LED state and toggling them atomically makes me a little queazy. What is strange to me is that even with a simple arrangement of cells and signals it lags. Also the flickering looks crappy.
Here’s a video, some screenshots of the patch, and some of the JS running it. Essentially I’ve got the state of all the objects stored in JSON and I push that out to
[dict]s on each beat. Then I clear the field (see clearField) below and redraw everything. I can’t use stuff like
clear messages or
/monome/grid/led/all 0 because column zero is a menu. Thank you.