From ad4f87e0ebfd361c69c7ba9adc29292305f21f7c Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 27 Jan 2026 22:16:23 +0100 Subject: feat(audio): Implement real-time spectrogram synthesizer Adds a multi-voice, real-time audio synthesis engine that generates sound from spectrogram data using an Inverse Discrete Cosine Transform (IDCT). Key features: - A thread-safe, double-buffered system for dynamically updating spectrograms in real-time without interrupting audio playback. - Core DSP components: FDCT, IDCT, and Hamming window functions. - A simple sequencer in the main loop to demonstrate scripted audio events and dynamic updates. - Unit tests for the new synth engine and Hamming window, integrated with CTest. - A file documenting the build process, features, and how to run tests. --- src/audio/window.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/audio/window.cpp (limited to 'src/audio/window.cpp') diff --git a/src/audio/window.cpp b/src/audio/window.cpp new file mode 100644 index 0000000..3f36480 --- /dev/null +++ b/src/audio/window.cpp @@ -0,0 +1,9 @@ +#include "window.h" +#include "util/math.h" +#include + +void hamming_window_512(float window[WINDOW_SIZE]) { + for (int i = 0; i < WINDOW_SIZE; ++i) { + window[i] = 0.54f - 0.46f * cosf(2.0f * PI * i / (WINDOW_SIZE - 1)); + } +} -- cgit v1.2.3