Repository navigation
Conversation
…h an IR (prototype) A machine declares an impulse response with `convolver` (an asset kind), and the host convolves the stereo input with it by uniform partitioned overlap-save (256-sample partitions, the fixed FFT in src/fft.zig), handing the kernel the result per sample as io.cv-l / io.cv-r, 256 samples late. The engine is built off the audio thread and published with the asset bindings; a replaced one retires through the same handoff. Effects now load and save their asset files in projects, so a project can pick the IR. Prototype for listening before a proposal: the IR is built for 48 kHz only, a swap has no crossfade, and four-channel true-stereo IRs aren't read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An effect can now load a file by asset name from a song script, which
CONVO's IR needs: fx("convo", assets={"room": ...}). A preset's own
assets come with it, as they do on tracks; no effect preset carried any
before CONVO's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The host convolves the input with an impulse response; PREDELAY, LO CUT, HI CUT, WIDTH, LEVEL and MIX run in fy after it, with the dry delayed to line up. Two IRs ship: a synthetic stereo hall and a bowed cymbal from VSCO 2 CE (CC0), with a preset each. docs/46 describes the convolver and its limits: the IR is built for 48 kHz, a swap doesn't crossfade, and the partitions are uniform. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h CONVO IR Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
@mparrett thank you! I had to cherry pick, this is already on main with authorship preserved. Closing :) |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds convolution to Slab: a host service that convolves an effect machine's input with an impulse response, and CONVO, a convolution reverb built on it. A demo is in
songs/convolver_demo.py; the video below plays the same phrase dry, through verb2's big hall for reference, through CONVO's synthetic hall, and through CONVO with a bowed cymbal as the IR.convolver-demo.mp4
Why the host does the convolution
A 3.5 s stereo IR is about 336,000 multiply-adds per sample done directly, far past a track's budget. FFT convolution in blocks is cheap, but block FFTs and partition spectra aren't what
dsp:kernels are for. So the host convolves and hands the kernel the result, and everything after it (predelay, filters, width, mix) stays in fy.What's here
src/convolver.zig: uniform partitioned overlap-save with N = 256. The IR is resampled, scaled so white noise keeps its level, and transformed into partition spectra when it loads, off the audio thread. Per block, the audio thread does one forward FFT, a multiply-accumulate over the partitions, and one inverse FFT; left and right share each transform as l + i·r.process()doesn't allocate.convolvermanifest word, used in place ofasset. The IR loads as an asset, so the UI can swap it and presets can name one. The kernel reads the result asio.cv-l/io.cv-r, 256 samples late, and reports that withlatency!.machines/convo, kernel inkernels/07-effects/convo.fy): PREDELAY, LO CUT, HI CUT, WIDTH, LEVEL and MIX. Two IRs ship with a preset each: a synthetic stereo hall (generated, not recorded) and a bowed cymbal from VSCO 2 CE (CC0).fx()takesassets=and carries a preset's assets, astrack()already does, so a song can choose an effect's IR.master-loudpreset, which it was missing; that's a separate commit.CONVO with the 3.5 s hall costs about 930 ns per sample in a ReleaseFast bench, under 5% of a core.
Limits
This is a prototype, and docs/46 lists what it doesn't do yet:
Testing
zig build testpasses, including two convolver tests: output matches direct convolution N samples late with a stereo IR, and a mono IR feeds both channels andresetclears the tail.zig build bench -- --all --check: every golden is bit-exact, and CONVO's are recorded. The run still exits 1 because shift2, resonator2, buffer2 and phaser2 have no goldens on master.🤖 Generated with Claude Code