Spectrogram¶
FFT processing and CustomPainter rendering.
Pipeline¶
FftProcessor¶
- Windowed FFT (Hann window) via the
ffteapackage - Converts complex spectrum to normalized dB magnitudes [0.0, 1.0]
- Configurable dB range (floor/ceiling) and FFT size
SpectrogramPainter (CustomPainter)¶
Uses a synchronous canvas-shift rendering strategy:
- Draw previous spectrogram image shifted left by N columns
- Draw new columns as colored rectangles on the right edge
Picture.toImageSyncproduces a GPU-backedui.Image- Single
drawImageRectcomposites to the main canvas
This avoids async decodeImageFromPixels which caused frozen spectrograms.
Color Maps¶
Pre-computed 256-entry ARGB lookup tables:
- Viridis — perceptually uniform, color-blind friendly (default)
- Magma — dark-to-bright purple/orange
- Inferno — dark black to vivid yellow
- Grayscale — simple luminance ramp
- BirdNET — custom brand blue palette
SpectrogramWidget¶
Bridges the audio ring buffer, FFT, and painter into a Flutter widget:
Tickerdrives animation at up to 60 fpsRepaintBoundaryisolates repaints from the widget tree- Supports optional log amplitude scaling and frequency axis labels