Sound wave simulation

28-08-2022

This is a naive attempt at simulating 2D sound wave propagation through simple materials. The concept is straightforward: there is a grid of cells, each with an offset and velocity, that propagate their offset to their neighbouring cells. This causes wave behaviour to emerge. The waves can be captured by a virtual microphone and directly played to the real-world audio output. Phenomena like echo, reverb, muffling, falloff, etc. are all emergent properties from this simple set of rules.

A major downside of this project is its inefficiency. To get a reasonable maximum frequency of 4kHz, the simulation has to be run 8k times per second. This just about works on my hardware, but I'd like the maximum frequency to reach the upper limit of our hearing at 20kHz. Even with multithreading, this doesn't seem to be possible. The obvious solution is to run the simulation on the GPU as a compute shader, but I haven't done that yet.

Dependencies

Walgelijk
Game engine
Present