Repository navigation
Pin DspTap 0.7.0; replace the five private Butterworth copies with DspTap's stage - #40
Merged
Merged
Conversation
submodules/dsptap moves from 2137d86 to a20b1ef, the commit that carries DspTap 0.7.0 (to be tagged v0.7.0): the Butterworth low-pass stage (tap/dsp/butterworth.h, 0.6.0) that the next commit adopts, its block kernel, and 0.7.0's cheaper set_cutoff(), which drops the group-delay scan from the redesign that TapTools' set_oversample() setters call. Nothing TapTools calls changes between the two pins: the FFT already ran the srdif engine at 2137d86 (fft.h, srdif.h and the vDSP backend gain move semantics and documentation only; yin, psola and pvoc are untouched), and the outputs of nr, spectra, conv_engine, tune (all three backends) and harmonizer are bit-identical across the two pins (FNV-1a over one second of a sawtooth plus noise, GCC 13, x86-64), so the executed notebooks stay as they are. - include/taptools/dsptap_version.h: static_assert(TAP_DSP_VERSION >= TAP_DSP_VERSION_ENCODE(0, 7, 0)), the floor DspTap's README asks a consumer to state. Included by every header that includes a tap/dsp header (stft.h, conv_engine.h, tune.h, harmonizer.h) rather than put in the umbrella, which no translation unit includes. - CMakeLists.txt: tap::dsp is a pure INTERFACE target (as it already was at the old pin); the comments describing an Ooura wrapper and a static library it links are corrected. - README.md, bench/fft_bench.cpp: DspTap vendors CMSIS-DSP and keeps only the Ooura package's license record; the FFT is the srdif engine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016GKzq1VSdcMYCRMhddiMaf
ladder.h, diode_ladder.h, overdrive.h and svf.h each carried a 4th-order Butterworth for the oversampling chain (two RBJ cookbook biquads at the Q pair 0.54119610 / 1.30656296), and fuzz.h an 8th-order one that ondes.h borrowed (four biquads). All five now run DspTap 0.7.0's tap::dsp::basic_butterworth_lowpass<double, N> (tap/dsp/butterworth.h: the bilinear design with pre-warping, Oppenheim & Schafer sec. 7.2, sections in increasing pole radius, the same transposed direct form II arithmetic and section order the copies ran) through one adapter: - include/taptools/butterworth.h: tap::tools::butterworth_lowpass<N>, with butterworth4 and butterworth8 as its instantiations, keeps the copies' call shape (design / tick / reset) so every call site stays as it was. The default constructor designs the stage at 0.225 cycles per sample (0.45 / 2, the 2x chains' corner and fuzz's per-stage corner) because the stage has none; design() is set_cutoff() (noexcept, allocation-free, 1.1 to 2.8 us at order 4 and 5.5 to 14 us at order 8 on x86-64 by DspTap 0.7.0's measurement) and returns at once at the cutoff the filter already has, so fuzz's configure() costs no redesign. fuzz::butterworth8 is an alias of it, so ondes.h's `using fuzz::butterworth8` is unchanged. The private biquad structs go where nothing else used them (ladder, diode, svf); overdrive and fuzz keep theirs for the voicing EQ, minus design_lowpass. - tests/butterworth_test.cpp: the stage against a reference copy of the old cookbook cascades at every corner a kernel designs (0.225, 0.1125, 0.05625), on noise at 0.9: measured at most 2.9e-9 (order 4) and 3.7e-9 (order 8), GCC 13 and Clang 18 alike, pinned under 1e-8; plus the nominal default design and reset(). Flush-to-zero. The stage's process() asserts in a Debug build that the calling thread flushes subnormals (tap/dsp/subnormals.h); DspTap leaves setting it to the host. tools/support/flush_to_zero.h is a scope that sets the bits (MXCSR FTZ | DAZ, FPCR.FZ, FPSCR.FZ) and restores the caller's register, its register write mirroring DspTap's test support (tests/support/iir_support.h) rather than copying it. This tree's hosts use it: a Catch2 listener around every test case (tests/support/flush_to_zero_listener.cpp; without it the Debug battery aborts in autowah_test, through svf's driven circuit), the C ABI's process entry points for svf, ladder, diode, tb303, autowah, overdrive, ondes and fuzz (the notebooks build tools/capi with no build type, so with assertions on), the three benchmarks that run these kernels and the five render tools that do. For the shipping objects, setting it on the audio threads is TapTools-Max's job; butterworth.h, the README and the ladder chapter say so, and that a Release host without it gets what the copies did: subnormal decay after the input stops, a CPU matter, not a sound one. Output difference, old copies against the stage (2 s each of a 110 Hz saw at 0.5, a 1003 Hz saw at 0.8 and white noise at 0.5, every oversampling factor, svf driven at orders 2 and 8, ondes as a source at 220 and 880 Hz; x86-64, GCC 13 -O3), max |difference| and that over the output's peak: ladder 3.5e-10 (1.1e-9), diode 2.1e-10 (9.9e-10), svf 3.7e-10 (4.4e-10), overdrive 7.1e-9 (1.3e-8), fuzz 2.5e-8 (2.4e-8, its drive amplifying the filter's difference), ondes 2.0e-10 (1.2e-9). The existing battery passes unchanged: 328 test cases, 1,763,565 assertions on GCC 13 and Clang 18 Release and on GCC 13 Debug, which runs the flush-to-zero precondition; GCC's warnings are the 44 the tree had. Notebooks. The eight that drive these kernels (autowah_validation, fuzz, ladder, ondes, overdrive, step_seq, svf, tb303) were executed against the old and the new C ABI on this machine: every printed figure and every plot (PNG bytes) is identical, so the committed notebooks stay as they are. The one line that would read differently is tb303's wall-clock ns/sample print, which times the notebooks' unoptimized (-O0) build of the C ABI: there the stage's one-frame process() call costs more than the inline copies did (about 480 -> 890 ns/sample for the fast solver on this machine, the exact/fast ratio 1.7 -> 1.3-1.4x). Nothing in the book cites it; the optimized cost is the benchmark below. Performance (bench/oversampling_bench.cpp, new: each oversampled kernel at each factor over 20 s of a sawtooth plus noise, flush-to-zero set, GCC 13 -O3, a shared 2.1 GHz Xeon VM). Instructions per input sample (callgrind), copies -> stage: ladder 2x/4x -4/0 %, diode -3/-1 %, svf driven -2/+4 %, overdrive 2x/4x/8x -8/+2/+9 %, fuzz +4/+7/+10 %, ondes +11/+13/+15 % (the stage's per-sample kernel runs its sections in a loop over a coefficient table, where the copies were inline calls). Wall clock (best of 30 runs interleaved over two sessions, pinned to one CPU): fuzz 8x 2.23 % of a core against 2.20 %, 4x 1.24 % against 1.26 %; every case within the host's run-to-run spread, which the 1x rows (no filter run) show at up to 24 %. svf_bench and diode_bench agree: diode within 2 %, svf driven -10 to +9 %. Handing the stage each input sample's 2 to 8 oversampled frames as one block (its block kernel) was measured too and was no better (instructions -4 to +18 % against the per-sample route), so the call sites stayed per sample. fuzz.h's cost paragraph and the fuzz chapter state the re-measurement beside the historical 3.16 / 3.02 %. Docs: the six kernel banners, README, bench/README.md and the book's machine chapters (ladder, diode, overdrive, svf, fuzz) describe the shared stage and cite it; the ladder chapter carries the flush-to-zero note for all of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016GKzq1VSdcMYCRMhddiMaf
tap
pushed a commit
to tap/SampleRateTap
that referenced
this pull request
Nov 25, 2026
The ×4 / ×8 / ×16 plan still listed DspTap's scaffold as open. It merged as tap/DspTap#67 on 2026-11-21 (tap/dsp/subband.h: subband_delta over the exact_delay_stage and subband_op concepts) and shipped in DspTap v0.3.0 beside IIR-a; this tree has pinned it since IIR-b, and rational's IIR battery runs its stages through it. - docs/X4_X8_PLAN.md: status v9 (X-c landed; what remains is the rest of TapTools), section 8 item 7 marked landed, and item 8's first step (TapTools' DspTap pin) marked done, past it at 0.7.0 (tap/TapTools#40). - docs/ROADMAP.md: the block's X-c entry landed, the TapTools entry's pin landed and the rest open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016GKzq1VSdcMYCRMhddiMaf
tap
pushed a commit
to tap/SampleRateTap
that referenced
this pull request
Nov 25, 2026
The ×4 / ×8 / ×16 plan still listed DspTap's scaffold as open. It merged as tap/DspTap#67 on 2026-11-21 (tap/dsp/subband.h: subband_delta over the exact_delay_stage and subband_op concepts) and shipped in DspTap v0.3.0 beside IIR-a; this tree has pinned it since IIR-b, and rational's IIR battery runs its stages through it. - docs/X4_X8_PLAN.md: status v9 (X-c landed; what remains is the rest of TapTools), section 8 item 7 marked landed, and item 8's first step (TapTools' DspTap pin) marked done, past it at 0.7.0 (tap/TapTools#40). - docs/ROADMAP.md: the block's X-c entry landed, the TapTools entry's pin landed and the rest open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016GKzq1VSdcMYCRMhddiMaf
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.
What this changes
Two commits.
1. The DspTap pin moves from
2137d86toa20b1ef. That is the commit carrying DspTap 0.7.0;v0.7.0is not tagged yet.include/taptools/dsptap_version.hasserts 0.7.0 as the floor. Every header that reaches intotap::dspincludes it.CMakeLists.txt,README.mdandbench/fft_bench.cpp.2. The five private Butterworth copies are replaced with DspTap's stage,
tap::dsp::basic_butterworth_lowpass<double, N>.butterworth4inladder.h,diode_ladder.h,overdrive.handsvf.h;butterworth8infuzz.h, whichondes.hreuses.include/taptools/butterworth.h(butterworth_lowpass<N>, withbutterworth4/butterworth8as aliases). It keeps the copies'design/tick/resetshape, so no call site changes.design()isset_cutoff(): noexcept and allocation-free. It returns at once when the cutoff is unchanged.tests/butterworth_test.cpp: the stage against a copy of the old cookbook cascades at every corner a kernel designs.tools/support/flush_to_zero.his a scope that sets the bits and restores the caller's register. This tree's own hosts use it:bench/oversampling_bench.cpptimes every oversampled kernel at every factor.README.md,bench/README.mdand the book's machine chapters (ladder, diode, overdrive, svf, fuzz) describe the shared stage and cite it.Why
Each of these kernels carried its own copy of the same filter. DspTap now has the stage, written for exactly this use: its
set_cutoff()is the allocation-free redesign thatset_oversample()needs while audio runs. 0.7.0 made that call cheaper: 1.1–2.8 µs at order 4 and 5.5–14 µs at order 8 on x86-64, down from 45–188 µs in 0.6.0.Verification
All on x86-64, Linux.
Builds. Each runs ctest 1/1: 328 test cases and 1,763,565 assertions (325 test cases before this PR).
mainhas.Format and lint. clang-format 18 is clean on the tree. clang-tidy 18 reports nothing on new or changed lines.
Output difference, old copies against the stage. Max |difference|, with the difference over the output's peak in brackets. Inputs: sawtooths at 110 and 1003 Hz plus white noise, at every oversampling factor.
butterworth_test.cpppins it under 1e-8.Performance (
bench/oversampling_bench.cpp, 20 s of audio, GCC 13 -O3, flush-to-zero set, a shared 2.1 GHz Xeon VM).Instructions per input sample (callgrind), copies → stage:
Wall clock: fuzz at 8× is 2.23 % of a core against 2.20 % with the copies. Every case is inside this host's run-to-run spread.
Passing the stage each input sample's oversampled frames as one block was measured too, and was no better.
Notebooks. The eight that drive these kernels were run against the old and the new C ABI. Every printed figure and every plot is identical (PNG bytes), so they are not re-executed.
Not run here: macOS arm64, where the compiler may fuse multiply-adds, and Windows. CI is the first gate for both; the 1e-8 test bound leaves room for contraction.
Notes for the reviewer
a20b1efcarries 0.7.0's version bump;v0.6.0is on3143a02.b26a7db, which re-records bench baselines only.v0.7.0is tagged anywhere other thana20b1ef, the pin follows it.-O0). There the stage's one-frameprocess()costs more than the inline copies did: about 480 → 890 ns/sample for the fast solver, and the printed exact/fast ratio drops from about 1.7× to 1.3–1.4×. Nothing in the book cites that line, and the committed notebook keeps its earlier run.OOURA_LICENSE.txt;book/src/fuzz.md's uncited "extra 1.4 % of a core";Generated by Claude Code