I am Richard Batelaan and I am an
undergraduate physics and music major at
the University of Nebraska-Lincoln.
Today, I will be discussing my UCARE 2020
project, Visualizing Sound Propagation.
The goal of my project was to design a
visual model of sound propagation in a
virtual room for educational use.
To accomplish this, I used Unity, which is
a game engine that can be used for
virtual reality. For my first approach, I
tried to create an expanding sphere that
could reflect off of virtual walls.
Unfortunately, after the second reflection
of the sound wave, the model becomes very
unclear. For my second approach, I used a
numerical solution to the 3D Wave Equation
to show the points in space of highest
sound pressure. This model clearly shows
interference of sound waves after the
first reflection. Here is a
video of this model.
The Expanding Ball Model shows the wave
fronts of sound coming from a source.
The room is part of a Revit model of the
Peter Kiewitt Institute in Omaha. In the
video, you can see the wave fronts change
color after each collision and disappear
after a while.
I used four C# scripts to create my first
model of sound propagation.
The SpawnerSample script spawns spheres in
every direction around a source, and each
sphere is given a velocity away from that
source. The effect is an expanding
sphere, just like a wave front of sound.
The BallBouncer script is attached to all
of these spheres and makes them bounce off
of the walls of the room. The script works by
setting the angle of incidence
equal to the angle of reflection at a collision.
The Destroyer script is also attached to
all of the spheres, and it destroys them
based on number of collisions and the
absorption coefficient of the material.
The absorption coefficient is the
percentage of sound absorbed and
transmitted by the material.
The ChangeColorOnCollision script changes
the color of the spheres after each
collision. After the first reflection,
the color changes to black, then yellow,
blue, red, and finally green.
The Numerical Wave Equation Model shows
the peaks of sound pressure when a source
creates sound. The higher the sound
pressure, the lower the transparency.
Here are three views of the model, from
the left, side, center, and right side of the room.
Here is the 3D Wave Equation that I used
for my model. The homogeneous part of the
partial differential equation is:
the second partial derivative of pressure
with respect to time minus the speed of
sound squared times the quantity,
the second partial derivative with respect
to x plus the second partial derivative
with respect to y plus the second partial
derivative with respect to z. The right
side of the equation is the source
function that I used for my model.
Sine of omega t caused the
source to oscillate over time.
e to the negative alpha t caused the
source to decay over time. And the last
part of the source function causes it to
have a spatial bell curve shape. There
are many constants in the equation that I
define later, like omega, which determines
the frequency; alpha, which determines the
source's rate of decay; and sigma, which
is the standard deviation of the bell
curve shape. Lastly, I set all of the
initial and boundary conditions equal to
zero because this is the simplest scenario.
In order to solve my 3D Wave Equation, I
used the Finite Difference Method to
numerically approximate the solution. We
use a simple rise over run approach to
approximate all the partial derivatives
of p. Using the same rise over run
method, we can then approximate all the
second partial derivatives of p, which
simplifies to the following.
When plugging these approximations into
our 3D Wave Equation and solving for
p(xi,yj,zk,th) we get a recursive formula.
Starting with initial and boundary
conditions, we can calculate any point,
P(x,y,z, and t), using this formula.
I used MATLAB to apply the Finite
Difference Method to my 3D Wave Equation.
The first part of this script defines all
the variables. The first series of
for loops assigns values to a
four-dimensional array, x by y by z by t.
The second series of for loops creates an
animated 3D plot of a cross-section of
the waves. The right video shown here is
a cross-section at the top edge of the
room. Notice that the waves start
propagating late because the waves have
not reached that position yet.
The left video shown here is a
cross-section at the center of the room.
Notice that the waves start
propagating immediately.
The next section of code saved a video of
these two animated 3D plots. The last
series of for loops writes the data to
64,000 different text files corresponding
to a 3D position each having a list of one
hundred time stamps for p.
I used two C# scripts to show my model in
Unity. The SpawnPixels script spawns
cubes at every position in a 10x10x10 box,
40 cubes in the x direction, 40 cubes in
the y direction, and 40 cubes
in the z direction, for a total of
64,000 cubes, or pixels.
The Wave script is attached to each pixel.
It reads the text file corresponding to
the position of that particular pixel to
determine its transparency.
In the future, we want this model to be
adjustable to different timbres and
frequencies. We will also work towards
using different shapes of rooms instead
of just a cubic box. Lastly, we can work
towards giving this sound propagation
model different boundary conditions,
basically merging the pros of both models.
And here are my references. Thank you!