diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-14 18:06:24 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-14 18:06:24 +0100 |
| commit | e9dde3cea39e69d6188a7f49034f6d95e4c8b6b4 (patch) | |
| tree | b3b383eff5f0d1d18bdbb781c331e6a31fcb25a7 /src/audio/tracker.h | |
| parent | b4c901700de0d9e867b9fd0c0c6a6586578f8480 (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'src/audio/tracker.h')
| -rw-r--r-- | src/audio/tracker.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/audio/tracker.h b/src/audio/tracker.h index 8e7a63f..8e89a4e 100644 --- a/src/audio/tracker.h +++ b/src/audio/tracker.h @@ -31,6 +31,9 @@ struct TrackerScore { const TrackerPatternTrigger* triggers; uint32_t num_triggers; float bpm; // BPM is used only for playback scaling (1 unit = 4 beats) + uint32_t humanize_seed = 0; + float timing_variation_pct = 0.0f; + float volume_variation_pct = 0.0f; }; // Global music data generated by tracker_compiler |
