onlaj / Piano-LED-Visualizer

Piano LED Visualizer: Connect an LED strip to your Raspberry Pi and create an immersive visual experience for your piano playing
MIT License
494 stars 107 forks source link

Add ledstrip fps stats #464

Closed stephen322 closed 11 months ago

stephen322 commented 11 months ago

Add fps stats (and a few others) to website homepage. Also an experimental fps limiter to save cpu.

Some stats on my Rasp Pi 3B: ~84 fps with menulcd screen off (I don't have a menulcd); ~50% process cpu. (Time spent in ws821x library not using cpu.) ~40 fps with menulcd screen on, but it isn't so bad since again isn't burning cpu, and seems to jump back to 84 when piano is played.

onlaj commented 11 months ago

Hello. I haven't had time to check it out, but it looks interesting. When the piano is played, the screen stops refreshing to give the best performance. Same with the screensaver; after some time it makes fewer refreshes per second, and later it disables the screen at all. I can't remember the exact logic. The fps limiter sounds good, but I will have to check if it doesn't collide with previous "power-saving" workarounds.

stephen322 commented 11 months ago

Actually, I can't imagine the limiter being used at this point. If you like I can change the pull request removing the limiter, but it is off by default anyway.

I don't even remember the reason I was playing with the idea. Although I do recall trying to investigate the issue surrounding "[...] many users reported problems with huge delay between key presses and lights reacting to it on Raspberrys other than Zero." That particular issue which came up under certain conditions seemed to disappear around the time of an OS update for me.

onlaj commented 11 months ago

If done correctly, it could allow effects like Rainbow's shift, fading, or velocity to be more time-consistent across different devices. Right now, it will fade the notes faster on the RPi 4. Probably. I don't own one. Although I would prefer to make it time-based, making it refresh more times per second depending on how fast the given device is. The total execution time would be the same on each device. If you are not planning to use frame limiter, please edit the PR, and I will test it and then merge.

stephen322 commented 11 months ago

FPS limiter code removed. Can be re-added later easily by reverting the commit.

onlaj commented 11 months ago

I̶'̶m̶ ̶g̶e̶t̶t̶i̶n̶g̶ ̶~̶1̶3̶ ̶F̶P̶S̶ ̶w̶i̶t̶h̶ ̶s̶c̶r̶e̶e̶n̶ ̶e̶n̶a̶b̶l̶e̶d̶ ̶a̶n̶d̶ ̶~̶1̶4̶ ̶F̶P̶S̶ ̶w̶i̶t̶h̶o̶u̶t̶ ̶s̶c̶r̶e̶e̶n̶ ̶o̶n̶ ̶R̶a̶s̶p̶b̶e̶r̶r̶y̶ ̶P̶i̶ ̶Z̶e̶r̶o̶.̶

Something was wrong with my RPi, I restarted it and re-cloned the repository, now I'm getting 33 FPS on idle with screen enabled, and 135(sic!) FPS with screen disabled.

Great work! Merging.

stephen322 commented 11 months ago

Hmm, I wonder how much of my 84 fps is due to having 288 leds not cut yet.

At 135 fps, you may want to try the fps limiter :)