summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 00:05:36 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitfe0cee90f9bd4caa60b907e502aec4cc0daa4b60 (patch)
treec5e66a261a13a137ebef4c355d7c2b559efff3bd /build.zig
parentaabb92d26f6b46cd4c482e0e2cbc8e9e9751db0d (diff)
downloadsketchbook-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 'build.zig')
-rw-r--r--build.zig1
1 files changed, 1 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 7bb3d0b..ac819c4 100644
--- a/build.zig
+++ b/build.zig
@@ -92,6 +92,7 @@ pub fn build(b: *Build) void {
b.step("test-sessions", "Test the sessions database: frames, keyframes, marks, clips").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = host, .filters = &.{"session"} })).step);
b.step("test-presentation", "Test presentation feedback, pacing and trace snapshots").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = host, .filters = &.{"presentation"} })).step);
+ b.step("test-audio", "Test the voice mixer: reconciling, limiting, pitch and groups").dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = host, .filters = &.{ "voice", "mixer" } })).step);
const setup_tests = b.step("test-setup", "Test resource setup lifecycle and arguments");
for ([_]*Build.Module{ host, b.createModule(.{ .root_source_file = b.path("src/sketch/root.zig"), .target = target, .optimize = optimize, .imports = sketch_imports }) }) |module| setup_tests.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = module, .filters = &.{"setup"} })).step);