Skip to content

Improved spectrogram by using the RHI - #174

Merged
kunitoki merged 14 commits into
mainfrom
dev/better_spectrogram
Sep 14, 2026
Merged

kunitoki merged 14 commits into
mainfrom
dev/better_spectrogram

Conversation

@kunitoki

@kunitoki kunitoki commented Aug 17, 2026

Copy link
Copy Markdown
Owner

This pull request introduces several significant improvements and fixes across the DSP, UI, and audio GUI components. The most notable changes are the introduction of double-precision support in the FFTProcessor, major GPU optimizations and accuracy improvements in the SpectrogramComponent, and a new repaint mode for UI components that optimizes partial redraws. Additionally, several bug fixes and documentation updates were made to reflect these enhancements.

DSP and FFTProcessor Improvements:

  • FFTProcessor is now templated on the sample type (float or double), with all backends supporting native double-precision paths. The public API now accepts buffers with any alignment, and references to the scaling enum must be qualified (e.g., FFTProcessor<float>::FFTScaling::asymmetric). [1] [2] [3] [4] [5]
  • Fixed the Ooura FFT double-precision backend build on all platforms by moving helper declarations to namespace scope.

Audio GUI (yup_audio_gui) Enhancements:

  • SpectrogramComponent now keeps its waterfall history on the GPU, using a precompiled shader bundle for efficient rendering. The scroll speed is adjustable, and the log-frequency to FFT-bin mapping is precomputed for performance. The component now requires a GPU render context.
  • Waterfall scroll is now framerate-independent, draining FFT rows over multiple passes if needed, and can be paused accurately. Failures are now reported via Logger::outputDebugString, and render resolution is exposed via a new constant.
  • SpectrumAnalyzerComponent and SpectrogramComponent now use a new SpectrumBinMapping for continuous, accurate log-frequency display, with improved interpolation and aggregation over bands.
  • Fixed a readiness bug in SpectrumAnalyzerState so that FFT data is available immediately after a bulk push.
  • SpectrumAnalyzerComponent now generates its spectrum outline per pixel column for smooth, continuous curves at any resolution.

UI and Graphics Updates:

  • Introduced ComponentNative::RepaintMode, allowing selection between repainting disjoint dirty rectangles (default) or a single bounding box for backward compatibility. Documentation updated to explain the new mode. [1] [2]
  • SDL windowing now expands dirty areas by half a pixel to prevent persistent lines from anti-aliased clips, addressing visual artifacts in continuously repainting components.

Other Fixes and Minor Changes:

  • Noise generation in SignalGenerator was refactored for clarity and correctness, using a common generateWhiteNoise() method and clamping brown noise output. [1] [2]
  • Minor code and documentation cleanups, including atomic header inclusion and removal of direct Ooura FFT documentation in favor of FFTProcessor. [1] [2]

These changes collectively improve performance, accuracy, and usability in both DSP and UI components.

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.06387% with 160 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.21%. Comparing base (97d7da7) to head (702491b).

Files with missing lines Patch % Lines
...up_audio_gui/displays/yup_SpectrogramComponent.cpp 44.23% 116 Missing ⚠️
.../yup_audio_gui/displays/yup_SpectrumBinMapping.cpp 82.40% 19 Missing ⚠️
...dio_gui/displays/yup_SpectrumAnalyzerComponent.cpp 71.42% 16 Missing ⚠️
modules/yup_dsp/frequency/yup_FFTProcessor.cpp 94.87% 4 Missing ⚠️
modules/yup_gui/component/yup_Component.cpp 93.93% 2 Missing ⚠️
.../yup_audio_gui/displays/yup_SpectrogramComponent.h 50.00% 1 Missing ⚠️
...es/yup_audio_gui/displays/yup_SpectrumBinMapping.h 66.66% 1 Missing ⚠️
...es/yup_dsp/frequency/yup_SpectrumAnalyzerState.cpp 87.50% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #174      +/-   ##
==========================================
+ Coverage   82.06%   82.21%   +0.14%     
==========================================
  Files         818      820       +2     
  Lines       87399    87623     +224     
==========================================
+ Hits        71720    72035     +315     
+ Misses      15679    15588      -91     
Files with missing lines Coverage Δ
...audio_gui/displays/yup_SpectrumAnalyzerComponent.h 92.30% <ø> (ø)
...p_audio_processors/spectral/yup_SpectralBridge.cpp 84.44% <100.00%> (ø)
...yup_audio_processors/spectral/yup_SpectralBridge.h 83.33% <ø> (ø)
...s/yup_dsp/convolution/yup_PartitionedConvolver.cpp 92.92% <100.00%> (ø)
modules/yup_dsp/frequency/yup_FFTProcessor.h 66.66% <ø> (+16.66%) ⬆️
modules/yup_dsp/onsets/yup_Spectrogram.h 100.00% <ø> (ø)
modules/yup_gui/component/yup_Component.h 76.00% <ø> (ø)
modules/yup_gui/component/yup_ComponentNative.cpp 100.00% <100.00%> (ø)
modules/yup_gui/component/yup_ComponentNative.h 33.33% <ø> (ø)
.../yup_audio_gui/displays/yup_SpectrogramComponent.h 85.71% <50.00%> (-6.60%) ⬇️
... and 7 more

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 97d7da7...702491b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kunitoki
kunitoki force-pushed the dev/better_spectrogram branch from 68f1a1e to a08da98 Compare September 7, 2026 00:15
@kunitoki
kunitoki merged commit 14efc7b into main Sep 14, 2026
41 checks passed
@kunitoki
kunitoki deleted the dev/better_spectrogram branch September 14, 2026 07:12
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.

1 participant