From e9dde3cea39e69d6188a7f49034f6d95e4c8b6b4 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 14 Feb 2026 18:06:24 +0100 Subject: feat(tracker): add sample offset and humanization Implements two tracker realism features: 1. Sample Offset (compile-time): - Add offset_sec field to NoteParams and Sample structs - Parse OFFSET parameter in SAMPLE directive - Apply timing shift during compilation (zero runtime cost) - Use for attack-heavy samples to align perceived beat 2. Humanization (runtime, deterministic): - Add humanize_seed, timing_variation_pct, volume_variation_pct to TrackerScore - Parse HUMANIZE directive with SEED/TIMING/VOLUME params - Apply per-event RNG jitter using std::minstd_rand - Deterministic: same seed produces identical output Both features work in real-time playback and WAV export. Test file: data/test_humanize.track Co-Authored-By: Claude Sonnet 4.5 --- src/audio/gen.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/audio/gen.h') diff --git a/src/audio/gen.h b/src/audio/gen.h index 94f4ee3..370971b 100644 --- a/src/audio/gen.h +++ b/src/audio/gen.h @@ -17,6 +17,7 @@ struct NoteParams { float harmonic_decay; float pitch_randomness; float amp_randomness; + float offset_sec = 0.0f; }; // Generates a single note into a new spectrogram buffer -- cgit v1.2.3