diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-04 14:00:10 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-04 14:00:10 +0100 |
| commit | 7dec3ee015f8741e62aa2d24556426778571fc14 (patch) | |
| tree | 2a2cb4b41115474d4fff56d77f360f85a8e81378 /src/audio/gen.cc | |
| parent | 18c553b0aaa9a574a2a40e5499120ac8a802b735 (diff) | |
fix(audio): WAV dump backend now properly triggers tracker patterns
Fixed critical bug where WavDumpBackend rendered only silence (zeros).
Root Cause Analysis:
- WavDumpBackend::start() called synth_render() in a loop
- BUT never called tracker_update() to trigger patterns
- Result: No voices triggered, synth rendered silence (zero-filled WAV)
The Fix:
- Added #include "tracker.h" to wav_dump_backend.cc
- Implemented music time simulation in WavDumpBackend::start()
- Now calls tracker_update(music_time) before each synth_render()
- Simulates tempo scaling phases (matches main.cc logic):
* 0-10s: tempo = 1.0x (steady)
* 10-15s: tempo = 1.0 → 2.0x (acceleration)
* 15-20s: tempo = 1.0x (reset)
* 20-25s: tempo = 1.0 → 0.5x (deceleration)
* 25s+: tempo = 1.0x (reset)
Technical Details:
- Calculate dt = kBufferSize / kSampleRate (time per audio buffer)
- Track music_time, physical_time, and tempo_scale
- Advance music_time by dt * tempo_scale each iteration
- Call tracker_update(music_time) to trigger patterns
- Then call synth_render() to render triggered voices
Enhanced Progress Output:
- Now shows: "Rendering: X.Xs / 60s (music: Y.Ys, tempo: Z.ZZx)"
- Final summary includes total music time
- Example: "60.00 seconds, 61.24 music time" (tempo scaling verified)
Verification:
✓ WAV file now contains actual audio data (not zeros)
✓ Hexdump shows varying sample values (37 00, df ff, etc.)
✓ 141,307 non-zero data lines in 3.7 MB file
✓ Tempo scaling visible in progress output
✓ All 16 tests passing (100%)
Before: Zero-filled WAV, no audio
After: Proper drum track with tempo scaling effects
handoff(Claude): WAV dump bug fixed, audio rendering confirmed
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/audio/gen.cc')
0 files changed, 0 insertions, 0 deletions
