diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-08 07:40:29 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-08 07:40:29 +0100 |
| commit | c9195f997f3e797f03ab90464e4158717198a167 (patch) | |
| tree | 331304f42870246efdc64cc97ad42de59444ef3a /src/audio/gen.cc | |
| parent | b8e6929cafa41681f0b27ac104c9cf1d4e510837 (diff) | |
style: Apply clang-format to all source files
Diffstat (limited to 'src/audio/gen.cc')
| -rw-r--r-- | src/audio/gen.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/audio/gen.cc b/src/audio/gen.cc index 0757b4d..cd36d54 100644 --- a/src/audio/gen.cc +++ b/src/audio/gen.cc @@ -70,15 +70,17 @@ std::vector<float> generate_note_spectrogram(const NoteParams& params, fdct_512(pcm_chunk, dct_chunk); // Scale up to compensate for orthonormal normalization - // Old non-orthonormal DCT had no sqrt scaling, so output was ~sqrt(N/2) larger - // Scale factor: sqrt(DCT_SIZE / 2) = sqrt(256) = 16 + // Old non-orthonormal DCT had no sqrt scaling, so output was ~sqrt(N/2) + // larger Scale factor: sqrt(DCT_SIZE / 2) = sqrt(256) = 16 // - // HOWEVER: After removing synthesis windowing (commit f998bfc), audio is louder. - // The old synthesis incorrectly applied Hamming window to spectrum (reducing energy by 0.63x). - // New synthesis is correct (no window), but procedural notes with 16x scaling are too loud. + // HOWEVER: After removing synthesis windowing (commit f998bfc), audio is + // louder. The old synthesis incorrectly applied Hamming window to spectrum + // (reducing energy by 0.63x). New synthesis is correct (no window), but + // procedural notes with 16x scaling are too loud. // - // Analysis applies Hamming window (0.63x energy). With 16x scaling: 0.63 × 16 ≈ 10x. - // Divide by 2.5 to match the relative loudness increase: 16 / 2.5 = 6.4 + // Analysis applies Hamming window (0.63x energy). With 16x scaling: 0.63 × + // 16 ≈ 10x. Divide by 2.5 to match the relative loudness increase: 16 / 2.5 + // = 6.4 const float scale_factor = sqrtf(DCT_SIZE / 2.0f) / 2.5f; // Copy to buffer with scaling |
