diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-02 09:38:46 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-02 09:38:46 +0100 |
| commit | bb8197075161f9c9ded51beab913150b43954e2c (patch) | |
| tree | c3835a0cb2133be28e5cc695b487395250fd1ea0 /src/audio/synth.h | |
| parent | b2ca699723b1695bd712ec68635a947c6ca3fd42 (diff) | |
feat(audio): OLA-IDCT synthesis with Hann window to eliminate clicks
Add v2 spectrogram format (SPEC_VERSION_V2_OLA) using overlap-add IDCT
with 50% overlap (hop=256, OLA_OVERLAP=256) and Hann windowing.
- dct.h: OLA_HOP_SIZE=256, OLA_OVERLAP=256
- synth.h: SPEC_VERSION_V1/V2_OLA constants; version field on Spectrogram
- window.h/cc: hann_window_512() alongside existing hamming_window_512()
- synth.cc: g_hann[] precomputed at init; OLA path in synth_render when
ola_mode=true (IDCT -> Hann -> add overlap tail -> save new tail ->
output OLA_HOP_SIZE samples); v1 path unchanged for backward compat
- tracker.cc: MP3 encoder now uses sliding 512-sample Hann window with
OLA_HOP_SIZE advance per frame; sets version=SPEC_VERSION_V2_OLA;
.spec files propagate header->version; generated notes stay v1
Existing .spec files must be regenerated to benefit from click-free OLA.
handoff(Claude): OLA done. .spec files need regen via MP3 tool to activate v2.
Diffstat (limited to 'src/audio/synth.h')
| -rw-r--r-- | src/audio/synth.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/audio/synth.h b/src/audio/synth.h index 3a42a61..61ecfd0 100644 --- a/src/audio/synth.h +++ b/src/audio/synth.h @@ -21,10 +21,14 @@ #define MAX_SPECTROGRAMS \ 32 // Current track: 14 unique, 32 provides comfortable headroom +#define SPEC_VERSION_V1 1 +#define SPEC_VERSION_V2_OLA 2 + struct Spectrogram { const float* spectral_data_a; // Front buffer const float* spectral_data_b; // Back buffer (for double-buffering) int num_frames; + int version; // SPEC_VERSION_V1 or SPEC_VERSION_V2_OLA }; void synth_init(); |
