/ proof-of-concept / steelsim31
Sign in
proof-of-concept / steelsim31
steelsim31 / scripts / README-dataset.md
22 lines · 4.0 KBCodeBlameHistory
3`scripts/generate.ts` renders many drumstick strikes headlessly and writes one WAV clip and one line of metadata per clip, for training and evaluating models that predict the sheet's material and dimensions from its sound. It serves `dist/` (build first with `npm run build`) to a headless Chromium with WebGPU through Playwright and drives several pages in parallel: one simulation is bound by the latency of its GPU dispatches, so a large GPU has room for many.
5 node --experimental-strip-types scripts/generate.ts --out DIR --count N [--start I] [--workers W] [--seed S] [--duration D] [--spacing S] [--fps F]
7Clip `i` is drawn from a generator seeded by `(seed, i)`, so the dataset is reproducible and can be regenerated or extended in pieces; existing clips in `DIR` are skipped. `scripts/show-samples.ts` prints the drawn parameters of a range of clips without rendering them, and `scripts/probe.ts` runs one configuration (a URL query, or `--seed S --index I` for a dataset clip with optional overrides) and prints the status as it runs.
9## Output
11- `DIR/clips/NNNNNN.wav`: 16-bit mono at 48 kHz, 3 s from the impact, peak-normalized to 0.99. The pressure in pascals at 1 m is `sample * wavScalePa` with `wavScalePa` from the metadata.
12- `DIR/index.jsonl`: one JSON object per clip, appended as clips finish. Targets: `E` (Pa), `rho` (kg/m^3), `h` (m), `Lx`, `Ly` (m; the width and the height); `nu` is fixed at 0.29. Derived: `kappa` (bending wave constant sqrt(D / rho h), m^2/s), `mass` (kg). Nuisance variables: `features` (the initial shape in the text form of `shape.ts`, or `none`), `shapeScale`, `peakToPeak`, `maxSlope`, `sigma0`, `sigma1`, `sigmaIn`, `strikeFracX`, `strikeFracY`, `strikeVelocity`, `listenerDist`, `listenerAzimuth`, `listenerElevation`. Numerics: `spacing`, `nx`, `ny`, `dt`, `totalSteps`. Audio: `peakPa`, `rmsPa`, `wavScalePa`, `maxForce` (peak contact force, N), `wmax` (largest displacement, m). Bookkeeping: `wallSeconds`, `link` (the app's query string for the clip, which reproduces it in the browser).
13- `DIR/failures.log`: clips that did not render (a runaway displacement, a lost GPU).
14- `DIR/gallery.html`: a page (copy of `scripts/gallery.html`) that lists the newest clips with players, parameters, and optional spectrograms; serve `DIR` with any static server.
16`scripts/pull-dataset.sh` copies the clips and the index from a remote machine into a local directory every couple of minutes.
18## Sampling (version 1)
20All draws are independent. The targets are log-uniform over about plus or minus 30 percent of the defaults: E in 120 to 220 GPa, rho in 6000 to 9500 kg/m^3, h in 0.6 to 1.1 mm, width in 9 to 16 in, height in 13 to 24 in. The nuisance variables are meant to make the model rely on what a real recording would also show: the initial shape is flat with probability 0.08 and otherwise a random feature list (bows, twist, dents, a crease, a smooth random field; see `randomFeatures` in `shape.ts`) with a height scale log-uniform in 0.5 to 5 mm, redrawn at half the scale while the largest slope exceeds 0.1; the strike point is uniform in 0.6 to 0.8 of the width and 0.25 to 0.45 of the height, the stick speed log-uniform in 2 to 4 m/s; sigma0 and sigma1 are the defaults times a log-uniform factor in 0.7 to 1.4; the listener is at 1 m with azimuth and elevation uniform in plus or minus 15 degrees. The grid spacing is fixed at 8 mm, the sheet is a rectangle, and the excitation is a single strike.
22Two things to keep in mind when interpreting predictions. In the linear regime the sheet's motion depends on E and rho only through E / rho, and its frequencies scale as h sqrt(E / rho) / L^2; separating E from rho, or h from the size, must rely on the amplitude (through the stick's momentum exchange with the sheet's mass) and on the nonlinearity, both of which a real recording shows less reliably than the simulation. With a fixed grid spacing the grid dispersion at a given frequency depends on the bending wave constant, which is a simulator artifact a model could in principle exploit.
↑↓ move↵openescclose