Skip to content

Spectrum: run on CPython, and move every frame on a desktop window - #39

Merged
bdbarnett merged 2 commits into
mainfrom
spectrum-ticks-cpython
Nov 7, 2026
Merged

bdbarnett merged 2 commits into
mainfrom
spectrum-ticks-cpython

Conversation

@bdbarnett

@bdbarnett bdbarnett commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Two fixes that keep the MP3 player's spectrum from working on CPython.

  • lib/spectrum/pump_levels.py imported ticks_diff and ticks_ms from time, which only MicroPython has, so the spectrum failed to start with an ImportError. They now come from multimer, as in spectrum/analyzer.py and the apps.
  • On a desktop window (SDL), the analyzer drew its bars into the window's texture but never presented them. An app that leaves presenting to LVGL (touchkit.shell.quiet_app_timers) has stopped appdev's refresh, so the bars appeared only when LVGL next drew something, about once a second. A display that needs presenting and has no row refresh is now shown after each frame. The P4's row refresh is unchanged.

The spectrum also needs audiometer.Meter.attach() on CPython, which audiodsp adds separately.

Tested on a Raspberry Pi 4 (CPython 3.13, SDL on Wayland, 800x480 DSI panel), MP3 player with a pump-fed spectrum. Sixteen screenshots about 80 ms apart all differ in the spectrum's area; before the second change, two of sixteen did. The analyzer's report reads 16-19 fps. Not run on a board after this change; the board path (present_rows) is untouched.

pump_levels took ticks_ms from time, which only MicroPython has, so the
MP3 player's spectrum failed to start on a computer. It now uses multimer,
as the rest of the apps do.
An app that leaves presenting to LVGL (touchkit's quiet_app_timers) stops
appdev's refresh, so on a desktop window the bars reached the screen only
when LVGL next drew something, about once a second. A display that needs
presenting and has no row refresh is now shown after each frame.
@bdbarnett bdbarnett changed the title Spectrum: the pump's levels run on CPython too Spectrum: run on CPython, and move every frame on a desktop window Nov 7, 2026
@bdbarnett
bdbarnett merged commit f61d43d into main Nov 7, 2026
6 checks passed
@bdbarnett
bdbarnett deleted the spectrum-ticks-cpython branch November 7, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant