diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 00:05:36 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | fe0cee90f9bd4caa60b907e502aec4cc0daa4b60 (patch) | |
| tree | c5e66a261a13a137ebef4c355d7c2b559efff3bd /src/main.zig | |
| parent | aabb92d26f6b46cd4c482e0e2cbc8e9e9751db0d (diff) | |
| download | sketchbook-fe0cee90f9bd4caa60b907e502aec4cc0daa4b60.tar.gz sketchbook-fe0cee90f9bd4caa60b907e502aec4cc0daa4b60.zip | |
audio: the voice mix plays at true volume below a knee and is limited only above it
Every mixed sample went through x/(1 + |x|), so one voice at 0.5 played
at 0.33, bent. The mix now passes through untouched up to 0.75 (-2.5
dBFS) and above it follows knee + (1 - knee)·u/(1 + u), u the excess over
the room left (the old curve is its knee-0 case): same value and slope
at the knee, rising, tending to 1. A clip normalised to full scale only
has its peaks bent (1 plays at 0.875); two at full scale sum to 0.958.
Per sample, no state, no lookahead, on the frame thread as before.
A unit test checks the curve: identity to the bit below the knee (every
997th float, both signs), rising and at most 1 from the knee to infinity
(every float near the knee), odd, slope 1 at the knee; `zig build
test-audio` runs the mixer's tests alone. The README says what the mixer
does, and that SDL clips the total of the voice mix and the streams.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/main.zig')
0 files changed, 0 insertions, 0 deletions
