Skip to content

examples/Mic_FFT: pace drawing by captured audio, build on PC - #407

Merged
lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:mic_fft_pacing
Oct 15, 2026
Merged

lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:mic_fft_pacing

Conversation

@ainyan03

Copy link
Copy Markdown
Contributor

Pace the Mic_FFT drawing by the captured audio

  • loop() advanced one drawing step whenever two recording requests were queued, whether or not new audio had arrived. The history row scrolls once per five steps, so its speed depended on how fast the display draws. On the PC (SDL) build it scrolled hundreds of rows per second over the same data.
  • A drawing cycle now starts only after a new block has been queued, so the history follows the capture rate. On a display that is slower than the capture rate, nothing changes.

Build the example on PC

  • decltype instead of the GNU typeof extension, and malloc / free instead of heap_caps_* outside ESP_PLATFORM, so the example builds as is with the native (SDL) build.

Testing

  • Built for ESP32-S3 (Arduino 3.x, ESP-IDF 5.5), ESP32 (Arduino 2.x) and native (SDL).
  • Ran on the native build (macOS) with the PC microphone: the spectrum and history follow the input, and the history no longer races.

loop() advanced one drawing step whenever two recording requests were
queued, whether or not new audio had arrived. The history row scrolls once
per five steps, so its speed depended on how fast the display draws: on
the PC build it scrolled hundreds of rows per second over the same data.
A drawing cycle now starts only after a new block has been queued, which
limits the history to the capture rate; a display slower than that is
unaffected.

Also use decltype instead of the GNU typeof extension, and malloc / free
instead of heap_caps_* outside ESP_PLATFORM, so the example builds as is
on the PC (SDL) build.
@lovyan03
lovyan03 merged commit 955a401 into m5stack:develop Oct 15, 2026
30 checks passed
@ainyan03
ainyan03 deleted the mic_fft_pacing branch October 15, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants