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. --- CMakeLists.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index b5ac51e..c9b8cad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,10 @@ add_executable(demo64k src/platform.cpp src/gpu/gpu.cpp src/audio/audio.cpp + src/audio/fdct.cpp + src/audio/idct.cpp + src/audio/window.cpp + src/audio/synth.cpp ) target_include_directories(demo64k PRIVATE @@ -30,3 +34,28 @@ if (DEMO_SIZE_OPT) target_link_options(demo64k PRIVATE -Wl,--gc-sections -s) endif() endif() + +option(DEMO_BUILD_TESTS "Build tests" OFF) +enable_testing() + +if(DEMO_BUILD_TESTS) + add_executable(test_window + src/tests/test_window.cpp + src/audio/window.cpp + ) + target_include_directories(test_window PRIVATE + src + ) + add_test(NAME HammingWindowTest COMMAND test_window) + + add_executable(test_synth + src/tests/test_synth.cpp + src/audio/synth.cpp + src/audio/idct.cpp + src/audio/window.cpp + ) + target_include_directories(test_synth PRIVATE + src + ) + add_test(NAME SynthEngineTest COMMAND test_synth) +endif() -- cgit v1.2.3