Physics-Based Sound Synthesis via Finite Element Modal Analysis
Structures are discretized into triangular mesh elements. Each node has degrees of freedom (DOFs) representing displacement. The system is governed by the generalized eigenvalue problem:
where K is the stiffness matrix, M is the mass matrix, ω are the natural frequencies, and φ are the mode shapes.
| Element | DOFs/Node | Application |
|---|---|---|
| CST (Constant Strain Triangle) | 2 (ux, uy) | Membrane vibration |
| Euler-Bernoulli Beam | 3 (ux, uy, θ) | Strings, beam shells |
| DKT (Discrete Kirchhoff Triangle) | 3 (w, θx, θy) | Plate bending |
| Method | When Used |
|---|---|
| cuSOLVER (GPU dense) | Small matrices (<2000 DOF) |
| Shift-invert Lanczos (CPU) | Large sparse matrices |
| SimplicialLDLT | Free-free boundary conditions |
Each mode is an independent damped harmonic oscillator. The total displacement (and sound pressure) is the superposition of all modes:
This closed-form solution is evaluated on GPU via CUDA — one thread per audio sample, all modes summed in parallel. 44.1kHz, 512-sample buffer, zero-latency analytical evaluation.
Acoustic radiation visualized in real-time using a Kirchhoff boundary integral evaluated on GPU via OpenGL compute shader:
Each boundary node acts as a point source with retarded time. The compute shader evaluates this at every pixel (up to 1920×1080), with per-pixel point-in-mesh occlusion testing.
Optional medium→structure coupling: pressure at each boundary node from other sources is computed and applied as force, enabling sympathetic resonance between separate structures through the air.
Interactive tuning mode for creating custom instruments with precise pitch control:
Converges within ±2 cents of target. Auto-retry with jitter on collapse.
Native file dialogs. Save tuned instruments as .txt files. 8 notes per instrument (C major scale, any octave C1–C8).
Rect, Circle, L-Shape, Triangle, Tuning Fork, Ring, String, Cross, Star
Harp, Piano, Guitar, Guitar+, Piano+, Violin, Harp+, Bow Strings
Box variants, BigBox, HexBox, DoubleBox, Tuned8/12, Bell shapes, Open+Box, Glass chambers
| Mode | Description |
|---|---|
| Strike | Single impulse at click point |
| Rapid | Continuous strikes at 20Hz while held |
| Bow | Gentle continuous excitation at 30Hz |
| Pluck | Click-drag to set force direction, release to strike |
| Sweep | Frequency sweep 20Hz–2kHz to find resonances |
| Region | Circular area strike with linear falloff |
| Blow* | Sinusoidal excitation at local resonant frequency |
| Bow+ | Friction-based bowing with stick-slip accumulator |
| Component | Technology |
|---|---|
| FEM Assembly | Eigen (C++ linear algebra) |
| Eigensolver | cuSOLVER + custom Lanczos |
| Audio Synthesis | CUDA kernel (1 thread/sample) |
| Audio Output | PortAudio (44.1kHz, float32) |
| Component | Technology |
|---|---|
| Rendering | OpenGL 4.5 Core + GLSL 450 |
| Medium Viz | GL Compute Shader |
| UI | Dear ImGui (docking branch) |
| Meshing | Triangle (Delaunay lib) |
3D Solid Elements — Tetrahedral FEM for volumetric vibration. Requires 3D mesher (TetGen) and 3D rendering.
Per-Mode Damping — Frequency-dependent damping instead of uniform ζ. Higher modes decay faster (material-accurate).
Tension-Based Strings — Wave equation elements (f ∝ 1/L) instead of beam bending (f ∝ 1/L²) for realistic string sound.
Convolution Reverb — Room impulse response applied post-synthesis for spatial realism.
BEM Acoustic Radiation — Full Boundary Element Method replacing the simplified Kirchhoff integral for accurate far-field radiation patterns.
Multi-Material Regions — Per-element material properties for composite structures (wood body + steel strings + brass frets).