Skip to content

feat(examples): laser-cut glockenspiel — the SCS closed-loop demo part#402

Merged
ecto merged 4 commits into
mainfrom
feat/glockenspiel-example
Jul 8, 2026
Merged

feat(examples): laser-cut glockenspiel — the SCS closed-loop demo part#402
ecto merged 4 commits into
mainfrom
feat/glockenspiel-example

Conversation

@ecto

@ecto ecto commented Jul 7, 2026

Copy link
Copy Markdown
Owner

The CAD half of the SCS closed-loop demo: a C6–C7 glockenspiel where every dimension is physics and every receipt claim has a household oracle — the loudest being a phone spectrogram.

What's in it

  • geometry.mjs — single source of truth. Bar lengths are solved from target pitches via the closed-form free-free beam model f₁ = 3.5608·(t/L²)·sqrt(E/12ρ); E and ρ come from vcad-kernel-sheet's materials registry (al-hard = 6061-T6) and are asserted against the live engine at build time. Cord holes sit on the fundamental's nodal lines (0.2242·L from each end). The stand's 16 deck holes sit directly under each bar's nodal holes — two converging rows, the tuning physics visible in the frame.
  • build.mjs — the full pipeline in-process: create → sheet_metal_check vs the SendCutSend catalog → unfold → per-part DXF → springback-compensated bend sequence → folded STEP + GLB → cost → receipt.json.
  • frequencies.mjs — the tuning table standalone (no build needed): note, target Hz, as-modeled length, predicted Hz, error in cents (≤1.2¢ from rounding to the 0.1 mm cut grid).

The DFM loop, exercised honestly

The stand's chamfered deck corners put material at the wall-bend ends: the naive fold fails sheet_metal_check with 4 tear-out warnings. sheet_metal_suggest_fix answers add_bend_relief; the build applies it in the design (parametric notches, visible in the DXF) and re-checks to zero. The build asserts the naive design fails and the fixed one passes — the self-heal loop is part of the test.

Material split is deliberate: SCS cuts 6061 but doesn't bend it (bars: cut-only, raw — coatings damp the ring); the stand uses their 0.125″ 5052-H32 bending stock at its fixed 3.18 mm radius and published K-factor (0.44).

Verification

  • All 9 parts check shop-ready against the sendcutsend catalog (0 errors, 0 warnings).
  • Stand DXF audited entity-by-entity: 1 closed exterior, all 16 hole loops at the exact nodal-row centers, 4 dashed bend centerlines on the allowance midline.
  • Folded STEP is ~12 MB (24-gon cord holes keep the B-rep writer's face count sane; 0.018 mm from true circles — an order of magnitude inside cut tolerance).
  • Bars: 3 loops each (outline + 2 nodal holes), total 715 g across the set.

Depends editorially on #397 for the plan doc link; no code dependency.

🤖 Generated with Claude Code

Eight free-free 6061-T6 bars tuned to C6-C7 major (lengths solved from
the closed-form beam model f1 = 3.5608*(t/L^2)*sqrt(E/12rho), E and rho
asserted against the kernel materials registry at build time) with cord
holes on the fundamental's nodal lines at 0.2242*L, plus a folded
5052-H32 U-channel stand whose deck holes trace the converging nodal
rows. Per docs/plans/2026-07-06-scs-closed-loop-demo.md (PR #397).

build.mjs drives the full pipeline in-process: sheet_metal_create ->
sheet_metal_check vs the SendCutSend catalog -> sheet_metal_suggest_fix
(the naive fold fails 4 bend-relief checks; the fix lands in the design
as parametric relief notches, not a skipped check) -> sheet_metal_unfold
-> per-part DXF -> springback-compensated bend sequence -> folded STEP +
GLB -> sheet_metal_cost, and emits receipt.json naming an oracle for
every claim. frequencies.mjs reproduces the tuning table standalone
(rounding to the 0.1 mm cut grid costs at most 1.2 cents).

6061 is deliberately the cut-only stock (SCS does not bend it); the
stand uses their 0.125" 5052 bending stock at its fixed 3.18 mm radius
and published K. All nine parts check shop-ready; outputs upload as-is.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated (UTC)
mecheval Ignored Ignored Jul 8, 2026 10:06pm
vcad Ignored Ignored Jul 8, 2026 10:06pm
vcad-docs Ignored Ignored Jul 8, 2026 10:06pm
vcad-mcp Ignored Ignored Jul 8, 2026 10:06pm

Request Review

New MCP tool: strike a flat free-free bar in simulation and verify its
pitch before ordering. Modal frequencies from both the closed-form
Euler-Bernoulli model and a hole-aware 1-D Hermite-beam FEM (cord holes
enter A(x) and I(x) exactly, w_eff = w - 2*sqrt(r^2 - (x-x0)^2));
strike-excited synthesis (mode shape at strike point x half-sine mallet
spectrum, Q-based decay with cord-at-holes suspension damping) -> 16-bit
44.1 kHz WAV -> Hann/FFT with parabolic peak interpolation -> cents
verdict vs note/expect_hz. Takes a flat sheet_metal_create document_id
(dims, material, holes read from the session) or an explicit bar spec;
E/rho resolve from the kernel materials registry. The modes table
{hz, gain, q} doubles as the payload for client-side Web Audio synthesis
in the viewer widget later.

The FEM immediately earned its keep: the glockenspiel's nodal cord holes
flatten every bar ~5 cents (stiffness loss where mode-1 curvature is
nonzero) — bigger than the 0.1 mm rounding error. Bar cut lengths are
now hole-compensated (~0.2 mm shorter) and build.mjs gains an order-gate
stage: every bar's synthesized strike must FFT within +-5 cents of its
target note or the build fails. All 8 land within +-1.7 cents; a WAV per
bar ships in out/. Overtones sit at the non-harmonic free-free ratios
(2.76/5.40/8.93) and a center strike suppresses mode 2, like a player.

12 new tests: exact eigenvalue roots, FEM==closed-form on a uniform bar
to <0.5 cent, overtone ratios, synth->FFT round trip <1 cent, strike
position physics, doc-geometry extraction, bent-part rejection.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ecto

ecto commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

Added: simulate_strike — the audio oracle, closed before the order. (ebd1a8c)

New MCP tool that strikes a flat bar in simulation and verifies its pitch through the audio path: hole-aware 1-D FEM modal analysis → mallet-excited synthesis → WAV → FFT peak → cents verdict.

The FEM immediately caught a real detune: the nodal cord holes flatten every bar ≈ −5 cents (stiffness loss where mode-1 curvature is nonzero) — bigger than the cut-grid rounding error. Cut lengths are now hole-compensated (~0.2 mm shorter), and build.mjs gained an order gate: every bar's synthesized strike must FFT within ±5 ¢ of its note or the build fails. All 8 land within ±1.7 ¢; out/ now ships a WAV per bar you can play against the physical strike when the box arrives.

Timbre physics is in there too: non-harmonic partials at 2.76/5.40/8.93 × f₁, center strike suppressing the antisymmetric mode 2, and cord-at-nodes suspension damping making the partials die in tenths of a second while the fundamental rings for seconds. Frequencies are first-principles; decay Q is a documented heuristic.

The modes table {hz, gain, q} in the tool result is the data contract for client-side Web Audio synthesis in the viewer widget (tap a bar in chat, hear the note) — follow-up, pending the single-canvas viewer deploy.

12 new tests (439 total pass): exact free-free eigenvalue roots, FEM ≡ closed form on a uniform bar to <0.5 ¢, synth→FFT round trip <1 ¢, strike-position physics, session-doc geometry extraction, bent-part rejection.

main moved server.ts to the assembler/ToolDef architecture, so
simulate_strike's registration is ported to the new pattern: a toolDefs
table exported from tools/acoustics.ts (pack sheet_metal, RW), spread in
the server assembler, named in LIST_TOOL_ORDER, and titled in
TOOL_METADATA — same three-point shape as the other sheet-metal tools.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Deliberate surface change: the strike-simulation tool joins tools/list
after sheet_metal_nest. Regenerated via UPDATE_TOOL_SURFACE=1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ecto
ecto merged commit 9acc2e3 into main Jul 8, 2026
13 checks passed
@chojiai

chojiai Bot commented Jul 8, 2026

Copy link
Copy Markdown

What shipped

You can now hear a part before you order it. A new "Simulate Strike" tool takes a flat bar design, models how it vibrates when struck, synthesizes the resulting sound as an audio file, and checks whether the dominant pitch lands within a specified tolerance of the target note — all before any metal is cut.

Alongside this, a complete laser-cut glockenspiel example (C6–C7 major scale, eight bars and a folded stand) demonstrates the full workflow: bar lengths derived from acoustic physics, suspension holes placed to preserve the fundamental, fabrication files checked against a real shop's capabilities, and every tuning claim verified by the simulated strike before the order goes out.


Plain-English summary generated by Choji from this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant