Woodblock#
A physically-based simulation of a single woodblock strike, sampled as acoustic pressure at a point in space. The model chain is a Hunt-Crossley mallet contact driving the bending modes of a free-free bar, two-way coupled to a Helmholtz cavity, radiating through distributed surface dipoles and a slit monopole to a listener point, then decimated to 48 kHz.
There is no microphone model: no directivity, no capsule response, no gain staging. The output is p(r, t) in pascals.
Contents#
| Path | What it is |
|---|---|
woodblock.md |
The specification: physics, equations, state vector, and the traps |
woodblock.py |
Reference implementation (numpy + scipy), and the source of the validation numbers |
matlab/ |
The algorithm in MATLAB syntax, run by numbl |
webapp/ |
Interactive browser app that executes the MATLAB code client-side |
The MATLAB code runs from the command line with cd matlab && numbl run woodblock_demo.m, or woodblock_validate.m to check it against the reference. The web app is a Vite project; see webapp/README.md.
Where the implementations differ#
woodblock.py is the reference; where it and the specification disagree, the script is right. The MATLAB implementation departs from it in one place, for speed: the system is nonlinear only while the mallet is in contact, so RK4 runs only until the mallet has provably separated, after which the linear body and cavity system is evolved in closed form from a single eigendecomposition, evaluated vectorized over the time axis. The free-phase solution is exact in time, and the two agree on every published diagnostic.
The app's default mallet stiffness is 1.0e8, softer than the reference default of 3.0e8; the validation script pins the reference value when comparing.