From 0bd2d4eae458d9017de4e2c4e04c1c1cc5315520 Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 3 Feb 2026 12:47:27 +0100 Subject: feat(audio): Fix tracker bugs and implement rock demo track Critical Bug Fixes: - Fixed pool exhaustion: Tracker slots never freed after use, music stopped after 8 patterns. Implemented round-robin allocation with cleanup. - Fixed note name parsing: Added automatic note-to-frequency conversion in tracker_compiler. Bass and melody now play correctly. - Fixed timing mismatch: Patterns are 2 seconds but triggered every 4 seconds, causing silence gaps. Updated SCORE to trigger every 2 seconds. Improvements: - Implemented dynamic resource sizing in tracker_compiler: Analyzes score to determine optimal MAX_VOICES/MAX_SPECTROGRAMS values. - Created comprehensive rock track: 11 patterns with drums, bass, power chords, and lead melody over 25 seconds. - Added 213 lines of asset system documentation with 8 prioritized tasks. Known Issues for next session: - Audio quality could be improved (some artifacts remain) - Note synthesis uses default parameters, needs tuning - Pattern overlaps might cause voice exhaustion under heavy load Files Changed: - src/audio/tracker.cc: Round-robin pool allocation, cleanup logic - tools/tracker_compiler.cc: Note name parser, resource usage analysis - src/audio/synth.h: Increased limits to 16 based on analysis - assets/music.track: 230-line rock arrangement - doc/ASSET_SYSTEM.md: Comprehensive documentation + 8 tasks - TODO.md: Updated with recent completions and known issues handoff(Gemini): Music system now functional but needs quality improvements. Audio artifacts and synthesis tuning remain. See TODO.md for details. Co-Authored-By: Claude Sonnet 4.5 --- src/audio/synth.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/audio/synth.h') diff --git a/src/audio/synth.h b/src/audio/synth.h index a0720f2..a8f15a9 100644 --- a/src/audio/synth.h +++ b/src/audio/synth.h @@ -7,8 +7,11 @@ #include "dct.h" #include +// Based on tracker score analysis (see generated/music_data.cc) +// Max simultaneous patterns: 5, recommended: 10 each +// Using 16 for comfortable headroom #define MAX_VOICES 16 -#define MAX_SPECTROGRAMS 8 +#define MAX_SPECTROGRAMS 16 struct Spectrogram { const float* spectral_data_a; // Front buffer -- cgit v1.2.3