From 9dcf94ab01269311b4e5d39be23c95560904c626 Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 27 Jan 2026 23:09:27 +0100 Subject: feat: Implement spectool & specview; refactor coding style; update docs This commit introduces new tools for spectrogram manipulation and visualization, establishes a consistent coding style, and updates project documentation. Key changes include: - **Spectrogram Tools: - : A command-line utility for analyzing WAV/MP3 files into custom spectrogram format and playing back these spectrograms via the synth engine. - : A command-line tool for visualizing spectrogram files as ASCII art in the console. - **Coding Style Enforcement: - Added a configuration file enforcing LLVM-based style with 2-space indentation, no tabs, and an 80-column line limit. - Renamed all C++ source files from to for project consistency. - Applied automatic formatting using exit across the entire codebase. - **Documentation & Workflow: - Created to define a commit policy requiring tests to pass before committing. - Updated with instructions for building and using and , and referenced . - Updated and to reflect the new tools, audio architecture decisions (real-time additive synthesis, double-buffering for dynamic updates, WAV/MP3 support), coding style, and development workflow. - **Build System: - Modified to: - Include new targets for and under the option. - Update source file extensions to . - Add a new end-to-end test for to the suite. --- src/tests/test_window.cpp | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 src/tests/test_window.cpp (limited to 'src/tests/test_window.cpp') diff --git a/src/tests/test_window.cpp b/src/tests/test_window.cpp deleted file mode 100644 index 1667dab..0000000 --- a/src/tests/test_window.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "audio/window.h" -#include -#include -#include - -// A simple floating point comparison with a tolerance -bool is_close(float a, float b, float epsilon = 1e-6f) { - return fabsf(a - b) < epsilon; -} - -int main() { - float window[WINDOW_SIZE]; - hamming_window_512(window); - - // Test 1: Window should start and end at the same small value - assert(is_close(window[0], 0.08f)); - assert(is_close(window[WINDOW_SIZE - 1], 0.08f)); - printf("Test 1 passed: Window start and end values are correct.\n"); - - // Test 2: Window should be symmetric - for (int i = 0; i < WINDOW_SIZE / 2; ++i) { - assert(is_close(window[i], window[WINDOW_SIZE - 1 - i])); - } - printf("Test 2 passed: Window is symmetric.\n"); - - // Test 3: The two middle points of the even-sized window should be equal and the peak. - assert(is_close(window[WINDOW_SIZE / 2 - 1], window[WINDOW_SIZE / 2])); - assert(window[WINDOW_SIZE / 2] > window[WINDOW_SIZE / 2 - 2]); // Should be greater than neighbors - printf("Test 3 passed: Window peak is correct for even size.\n"); - - printf("All tests passed for Hamming window!\n"); - - return 0; -} -- cgit v1.2.3