- Sound Transformer Data Compute System
A high-performance, GPU-accelerated sound simulation and synthesis system for Unity, using FDTD (Finite-Difference Time-Domain) methods. This project enables realistic sound propagation, material-based effects, and interactive audio synthesis for games and research.
| Feature | Description |
|---|---|
| FDTD Sound Simulation | Real-time pressure and velocity field simulation using compute shaders. |
| Material Modeling | Supports air, steel, aluminum, wood, and water for realistic sound effects. |
| Enhanced Sources | Trigger metallic, wooden, and liquid sounds with physical parameters. |
| Audio Output | Direct synthesis to Unity's AudioSource with post-processing. |
| Visualization | 3D grid and source visualization in the Unity Editor. |
| Manual Triggering | Interactive sound events via keyboard or script. |
- Unity 6000.0.26f1
- Clone the repository:
git clone https://github.com/InboraStudio/WaveBlender-Sound-Transformer-Compute-Unity3D.git
- Open in Unity (2022.3+ recommended).
- Assign the
WaveBlenderSolverandWaveBlenderDemoscripts to GameObjects. - Assign the
WaveBlenderFDTD.computeshader to the solver. - Press Play and interact using Space (metal), W (wood), Q (water drop).
| Script | Purpose |
|---|---|
[WaveBlenderSolver](Assets/Inbora Studio/Scripts/WaveBlenderSolver.cs) |
Core simulation and audio synthesis. |
[WaveBlenderDemo](Assets/Inbora Studio/Scripts/WaveBlenderDemo.cs) |
Keyboard-triggered sound events. |
- FDTD Simulation: Pressure and velocity fields are updated on the GPU using [
WaveBlenderFDTD.compute](Assets/Inbora Studio/Shaders/WaveBlenderFDTD.compute). - Material Effects: Each sound source can be assigned a material type, affecting propagation and timbre.
- Audio Sampling: Listener position is mapped to the simulation grid, and audio is synthesized in real time.
For more details on FDTD sound simulation, see the foundational paper:
- Unity Technologies
- Newtonsoft.Json
- Research on FDTD sound simulation
| Technology | Purpose |
|---|---|
| Unity Compute Shaders | High-performance, parallel simulation of sound fields on GPU. |
| Finite-Difference Time-Domain (FDTD) | Numerical method for simulating wave propagation in 3D. |
| Material Modeling | Realistic sound behavior for air, steel, wood, water, etc. |
| Async GPU Readback | Efficient transfer of simulation data from GPU to CPU for audio output. |
| Real-Time Audio Synthesis | Converts simulated pressure fields into playable audio in Unity. |
The project solves the 3D acoustic wave equation using FDTD:
Where:
- ( p ) = pressure field
- ( c ) = speed of sound (varies by material)
- ( \nabla^2 ) = Laplacian operator (spatial derivatives)
The pressure and velocity fields are discretized on a 3D grid and updated every timestep using central differences.
Each grid cell can represent a different material (air, steel, wood, water, etc.), affecting:
- Density (( \rho ))
- Speed of Sound (( c ))
- Damping/Absorption
This enables realistic simulation of sound transmission, reflection, and absorption.
Sound sources are injected with physical parameters:
- Frequency
- Amplitude
- Damping
- Material Type
- Phase
Special logic in the compute shader creates metallic ringing, wooden knocks, and water drops using envelope functions and harmonics.
The pressure field near the listener is sampled and spatially averaged for anti-aliasing. The sampled pressure is then post-processed:
- Soft Clipping: Prevents harsh distortion.
- Low-Pass Filtering: Smooths the audio signal.
- Simple Reverb: Adds echo using a circular buffer.
The simulation grid and sources are visualized in the Unity Editor using Gizmos, with color-coding for different materials.
- GPU-Accelerated Physics: Real-time sound simulation for large 3D grids.
- Material-Aware Audio: Hear the difference between metal, wood, and water impacts.
- Interactive Triggering: Sounds can be triggered via keyboard or script.
- Research-Grade Math: Based on FDTD sound propagation papers.
- Finite-Difference Time-Domain Simulation of Sound Propagation in 3D
- Unity Compute Shaders Documentation
*Explore the code for more details and experiment with different materials