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 --- data/test_humanize.track | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 data/test_humanize.track (limited to 'data/test_humanize.track') diff --git a/data/test_humanize.track b/data/test_humanize.track new file mode 100644 index 0000000..1da75e6 --- /dev/null +++ b/data/test_humanize.track @@ -0,0 +1,11 @@ +BPM 120 +SAMPLE kick, 80, 0.3, 1.0, 0.01, 3, 0.6 OFFSET 0.01 +SAMPLE snare, 200, 0.2, 1.0, 0.01, 2, 0.5 +HUMANIZE SEED 42 TIMING 5 VOLUME 10 + +PATTERN main LENGTH 1.0 + 0.0, kick, 1.0, 0.0 + 0.5, snare, 1.0, 0.0 + +SCORE + 0.0, main -- cgit v1.2.3