WolframAlpha.com
WolframCloud.com
All Sites & Public Resources...
Products & Services
Wolfram|One
Mathematica
Wolfram|Alpha Notebook Edition
Programming Lab
Finance Platform
SystemModeler
Wolfram Player
Wolfram Engine
WolframScript
Enterprise Private Cloud
Enterprise Mathematica
Wolfram|Alpha Appliance
Enterprise Solutions
Corporate Consulting
Technical Consulting
Wolfram|Alpha Business Solutions
Resource System
Data Repository
Neural Net Repository
Function Repository
Wolfram|Alpha
Wolfram|Alpha Pro
Problem Generator
API
Data Drop
Products for Education
Mobile Apps
Wolfram Player
Wolfram Cloud App
Wolfram|Alpha for Mobile
Wolfram|Alpha-Powered Apps
Services
Paid Project Support
Wolfram U
Summer Programs
All Products & Services »
Technologies
Wolfram Language
Revolutionary knowledge-based programming language.
Wolfram Cloud
Central infrastructure for Wolfram's cloud products & services.
Wolfram Science
Technology-enabling science of the computational universe.
Wolfram Notebooks
The preeminent environment for any technical workflows.
Wolfram Engine
Software engine implementing the Wolfram Language.
Wolfram Natural Language Understanding System
Knowledge-based broadly deployed natural language.
Wolfram Data Framework
Semantic framework for real-world data.
Wolfram Universal Deployment System
Instant deployment across cloud, desktop, mobile, and more.
Wolfram Knowledgebase
Curated computable knowledge powering Wolfram|Alpha.
All Technologies »
Solutions
Engineering, R&D
Aerospace & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Mechanical Engineering
Operations Research
More...
Finance, Statistics & Business Analysis
Actuarial Sciences
Bioinformatics
Data Science
Econometrics
Financial Risk Management
Statistics
More...
Education
All Solutions for Education
Trends
Machine Learning
Multiparadigm Data Science
Internet of Things
High-Performance Computing
Hackathons
Software & Web
Software Development
Authoring & Publishing
Interface Development
Web Development
Sciences
Astronomy
Biology
Chemistry
More...
All Solutions »
Learning & Support
Learning
Wolfram Language Documentation
Fast Introduction for Programmers
Wolfram U
Videos & Screencasts
Wolfram Language Introductory Book
Webinars & Training
Summer Programs
Books
Need Help?
Support FAQ
Wolfram Community
Contact Support
Premium Support
Premier Service
Technical Consulting
All Learning & Support »
Company
About
Company Background
Wolfram Blog
Events
Contact Us
Work with Us
Careers at Wolfram
Internships
Other Wolfram Language Jobs
Initiatives
Wolfram Foundation
MathWorld
Computer-Based Math
A New Kind of Science
Wolfram Technology for Hackathons
Student Ambassador Program
Wolfram for Startups
Demonstrations Project
Wolfram Innovator Awards
Wolfram + Raspberry Pi
Summer Programs
More...
All Company »
Search
Join
Sign In
Dashboard
Groups
People
Message Boards
Answer
(
Unmark
)
Mark as an Answer
GROUPS:
Staff Picks
Data Science
Image Processing
Music and Sound
Mathematica
Graphics and Visualization
Wolfram Language
Modeling
Machine Learning
Wolfram High School Summer Camp
10
Wolfram Emerging Leaders Program
[WELP20] Acoustic Modeling with Generated Depth Maps
Wolfram Emerging Leaders Program, Wolfram Summer Programs
Posted
1 month ago
661 Views
|
0 Replies
|
10 Total Likes
Follow this post
|
The Wolfram Emerging Leaders Program is a 4 month long project based program designed for gifted high school students to take a deep dive into a topic of their choice. Students work remotely in small groups to take their project from ideation to completion, with the guidance of Wolfram experts. Wolfram Emerging Leaders Program participants are selected from the Wolfram High School Summer Camp, which is open to talented, STEM oriented students age 17 and under.
This essay was written by:
◼
Timothy Bilik
◼
Logan Gilbert
◼
Emily Hyun
◼
Shubham Kumar
Introduction
This project aims to explore the propagation of sound in three dimensional regions. We begin by experimenting with acoustic modeling using primitive shapes.
After coming up with a working acoustic model, we utilized a depth sensing neural network to extrapolate data from single images. Using this data, we were able to create a boolean region that is representative of the environment being surveyed.
We integrated this depth map with our acoustic model to obtain attenuation coefficients which were applied to sample audio.
Throughout the process, we were able to come across interesting visualizations, learn about the basic physics behind acoustics and explore digital signal processing.
2D Modeling
The Helmholtz Equation
This partial differential equation is a time independent form of the Wave Equation and is used in physics to model many phenomena. We use it hear to model the pressure distribution in a region when different frequencies are emitted from a monopole sound source.
Preliminary Functions & Attributes from PDE Models Documentation
I
n
[
]
:
=
M
a
x
G
r
i
d
S
i
z
e
[
c
_
,
ω
_
,
R
e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{
f
5
0
0
}
]
I
n
t
e
r
p
o
l
a
t
i
n
g
F
u
n
c
t
i
o
n
D
o
m
a
i
n
:
{
{
0
.
,
1
.
}
,
{
0
.
,
1
.
}
}
O
u
t
p
u
t
:
s
c
a
l
a
r
Some examples
I
n
[
]
:
=
;
These are plots of the pressure distributions of various regions that we simulated sound propagation in. Each exhibited different characteristics and provided insight on how we can tune our model.
3D Modeling with Primitive Shapes
The Helmholtz Equation
Creating the Simulation Domain
I
n
[
]
:
=
Ω
=
R
e
g
i
o
n
[
C
o
n
e
[
{
{
0
,
0
,
0
}
,
{
0
,
0
,
2
}
}
,
1
]
]
;
R
e
g
i
o
n
P
l
o
t
3
D
[
Ω
]
O
u
t
[
]
=
Setting Sound Source Location
I
n
[
]
:
=
x
s
=
0
;
y
s
=
0
;
z
s
=
0
;
r
=
1
;
Creating the Acoustic Model
I
n
[
]
:
=
m
o
n
o
p
o
l
e
M
o
d
e
l
3
D
=
A
c
o
u
s
t
i
c
M
o
d
e
l
[
p
[
x
,
y
,
z
]
,
{
x
,
y
,
z
}
,
ρ
,
{
Q
[
ω
,
{
x
,
y
,
z
}
,
{
x
s
,
y
s
,
z
s
}
]
,
{
0
}
}
]
-
2
ω
p
[
x
,
y
,
z
]
ρ
2
c
;
Setting a Boundary Condition
I
n
[
]
:
=
Γ
a
b
c
=
N
e
u
m
a
n
n
V
a
l
u
e
-
ω
c
+
1
2
r
p
[
x
,
y
,
z
]
ρ
,
T
r
u
e
;
Creating the PDE
p
d
e
=
{
m
o
n
o
p
o
l
e
M
o
d
e
l
3
D
Γ
a
b
c
}
/
.
{
c
c
a
i
r
,
ρ
ρ
a
i
r
}
;
Solving the PDE
p
f
u
n
M
o
n
o
p
o
l
e
3
D
=
P
a
r
a
m
e
t
r
i
c
N
D
S
o
l
v
e
V
a
l
u
e
[
p
d
e
,
p
,
{
x
,
y
,
z
}
∈
o
m
e
g
a
,
{
ω
}
,
A
c
o
u
s
t
i
c
s
O
p
t
i
o
n
s
[
c
a
i
r
,
ω
]
]
Visualizing Results
p
M
o
n
o
p
o
l
e
5
0
0
H
z
C
o
n
e
=
p
f
u
n
M
o
n
o
p
o
l
e
3
D
[
2
π
f
/
.
{
f
5
0
0
}
]
;
Examples & Tests
While we tried to generate visualizations for this, the process was too computationally intensive. In the future, we will attempt to render high quality plots to further investigate this model.
Depth Map
Single-Image Depth Perception Net
Here is an example image from Wolfram:
I
n
[
]
:
=
i
m
g
=
;
A neural network exists that can convert an image into a depth map that doesn’t require multi-view reconstruction.
We obtain the depth map using the neural network “Single-Image Depth Perception Net Trained on NYU Depth V2 and Depth in the Wild Data”.
I
n
[
]
:
=
d
e
p
t
h
M
a
p
=
N
e
t
M
o
d
e
l
[
"
S
i
n
g
l
e
-
I
m
a
g
e
D
e
p
t
h
P
e
r
c
e
p
t
i
o
n
N
e
t
T
r
a
i
n
e
d
o
n
N
Y
U
D
e
p
t
h
V
2
a
n
d
D
e
p
t
h
i
n
t
h
e
W
i
l
d
D
a
t
a
"
]
[
i
m
g
]
;
This allows us to view the depth in a two dimensional visualization
I
n
[
]
:
=
I
m
a
g
e
A
d
j
u
s
t
[
I
m
a
g
e
[
d
e
p
t
h
M
a
p
]
]
O
u
t
[
]
=
We can better visualize the depthMap with ListPlot3D, which should give us a 3D rendering of the depth of the image.
I
n
[
]
:
=
L
i
s
t
P
l
o
t
3
D
[
d
e
p
t
h
M
a
p
,
P
l
o
t
S
t
y
l
e
T
e
x
t
u
r
e
[
i
m
g
]
]
O
u
t
[
]
=
Notice that some of the depth data has been inaccurately captured. The distance between the farthest point and the closest point in the image doesn’t appear to be recreated in the depth map. The accuracy of relative positions between the points isn’t maintained.
Fine Tuning the output
We found that multiplying the created depth map by the square root of itself can sometimes yield a more accurate depth map. An example is listed below.
Sample Image:
I
n
[
]
:
=
i
m
g
=
;
Again, we obtain the depthMap using the neural net.
I
n
[
]
:
=
d
e
p
t
h
M
a
p
M
o
d
e
l
=
N
e
t
M
o
d
e
l
[
"
S
i
n
g
l
e
-
I
m
a
g
e
D
e
p
t
h
P
e
r
c
e
p
t
i
o
n
N
e
t
T
r
a
i
n
e
d
o
n
N
Y
U
D
e
p
t
h
V
2
a
n
d
D
e
p
t
h
i
n
t
h
e
W
i
l
d
D
a
t
a
"
]
[
i
m
g
]
;
This time, we apply a square root function to the depth values.
I
n
[
]
:
=
d
e
p
t
h
M
a
p
M
o
d
e
l
=
S
q
r
t
[
A
b
s
[
R
e
v
e
r
s
e
@
d
e
p
t
h
M
a
p
M
o
d
e
l
]
]
*
(
-
R
e
v
e
r
s
e
@
d
e
p
t
h
M
a
p
M
o
d
e
l
)
;
Visualizing the plot gives us a smooth and accurate depth perception map.
I
n
[
]
:
=
L
i
s
t
P
l
o
t
3
D
[
d
e
p
t
h
M
a
p
M
o
d
e
l
,
P
l
o
t
S
t
y
l
e
T
e
x
t
u
r
e
[
i
m
g
]
,
P
l
o
t
T
h
e
m
e
{
"
M
i
n
i
m
a
l
"
,
"
N
o
A
x
e
s
"
}
,
V
i
e
w
P
o
i
n
t
{
0
,
-
0
.
9
6
,
1
.
8
4
}
]
O
u
t
[
]
=
We’ve incorporated some post-processing to help improve the accuracy of depth perception here.
Creating a Boolean Region
Method 1 - Hexahedrons
A depth map can be re-created into a boolean region by converting each depth map point into a hexahedron, where the depth value is associated with the height of each hexahedron.
Obtaining a depth map:
I
n
[
]
:
=
d
e
p
t
h
M
a
p
=
N
e
t
M
o
d
e
l
[
"
S
i
n
g
l
e
-
I
m
a
g
e
D
e
p
t
h
P
e
r
c
e
p
t
i
o
n
N
e
t
T
r
a
i
n
e
d
o
n
N
Y
U
D
e
p
t
h
V
2
a
n
d
D
e
p
t
h
i
n
t
h
e
W
i
l
d
D
a
t
a
"
]
;
Creating the vertices defining each hexahedron that will create the region:
I
n
[
]
:
=
p
t
s
=
T
a
b
l
e
[
{
{
x
-
1
,
y
-
1
,
-
5
0
}
,
{
x
-
1
,
y
,
-
5
0
}
,
{
x
,
y
,
-
5
0
}
,
{
x
,
y
-
1
,
-
5
0
}
,
{
x
-
1
,
y
-
1
,
d
e
p
t
h
M
a
p
[
[
x
]
]
[
[
y
]
]
*
1
0
}
,
{
x
-
1
,
y
,
d
e
p
t
h
M
a
p
[
[
x
]
]
[
[
y
]
]
*
1
0
}
,
{
x
,
y
,
d
e
p
t
h
M
a
p
[
[
x
]
]
[
[
y
]
]
*
1
0
}
,
{
x
,
y
-
1
,
d
e
p
t
h
M
a
p
[
[
x
]
]
[
[
y
]
]
*
1
0
}
}
,
{
x
,
1
,
D
i
m
e
n
s
i
o
n
s
[
d
e
p
t
h
M
a
p
]
[
[
1
]
]
,
1
}
,
{
y
,
1
,
D
i
m
e
n
s
i
o
n
s
[
d
e
p
t
h
M
a
p
]
[
[
2
]
]
,
1
}
]
;
I
n
[
]
:
=
p
t
s
=
F
l
a
t
t
e
n
[
p
t
s
,
2
]
;
Creating a Mesh Region with the hexahedrons:
I
n
[
]
:
=
Ω
=
M
e
s
h
R
e
g
i
o
n
[
p
t
s
,
H
e
x
a
h
e
d
r
o
n
[
P
a
r
t
i
t
i
o
n
[
R
a
n
g
e
[
2
4
0
*
3
2
0
*
8
]
,
8
]
]
]
O
u
t
[
]
=
Using this mesh region we were able to accurately translate the depth data from an image to a boolean region. Note that each pixel in the image has a depth value associated with it, which dictated how tall the hexahedron corresponding to that pixel is. We simply combined all of these hexahedrons to create the region shown above. We need our data in this format to be compatible with our acoustic model. In order for the mesh region to be compatible, it needs to fit in a 1 by 1 by 1 region. The function below accomplishes that. We simply rescale the values to fit this constraint.
I
n
[
]
:
=
I
m
a
g
e
2
M
e
s
h
R
e
g
i
o
n
[
i
m
a
g
e
_
I
m
a
g
e
,
m
i
n
B
o
u
n
d
_
I
n
t
e
g
e
r
:
0
,
m
a
x
B
o
u
n
d
_
I
n
t
e
g
e
r
:
1
]
:
=
M
o
d
u
l
e
[
{
d
e
p
t
h
M
a
p
,
m
i
n
D
e
p
t
h
,
m
a
x
D
e
p
t
h
,
i
n
c
,
w
i
d
t
h
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i
n
c
,
m
i
n
B
o
u
n
d
}
,
{
x
*
i
n
c
,
(
y
-
1
)
*
i
n
c
,
m
i
n
B
o
u
n
d
}
,
{
(
x
-
1
)
*
i
n
c
,
(
y
-
1
)
*
i
n
c
,
d
e
p
t
h
M
a
p
[
[
x
]
]
[
[
y
]
]
}
,
{
(
x
-
1
)
*
i
n
c
,
y
*
i
n
c
,
d
e
p
t
h
M
a
p
[
[
x
]
]
[
[
y
]
]
}
,
{
x
*
i
n
c
,
y
*
i
n
c
,
d
e
p
t
h
M
a
p
[
[
x
]
]
[
[
y
]
]
}
,
{
x
*
i
n
c
,
(
y
-
1
)
*
i
n
c
,
d
e
p
t
h
M
a
p
[
[
x
]
]
[
[
y
]
]
}
}
,
{
x
,
w
i
d
t
h
}
,
{
y
,
h
e
i
g
h
t
}
]
;
M
e
s
h
R
e
g
i
o
n
[
F
l
a
t
t
e
n
[
p
t
s
,
2
]
,
H
e
x
a
h
e
d
r
o
n
[
P
a
r
t
i
t
i
o
n
[
R
a
n
g
e
[
w
i
d
t
h
*
h
e
i
g
h
t
*
8
]
,
8
]
]
]
)
]
Method 2 - Discretized Region Plot
The depth map can be interpolated into a function and then discretized as shown below.
Obtaining an Interpolation Function for the data:
I
n
[
]
:
=
f
=
L
i
s
t
I
n
t
e
r
p
o
l
a
t
i
o
n
[
R
e
s
c
a
l
e
[
d
e
p
t
h
M
a
p
,
{
M
i
n
[
d
e
p
t
h
M
a
p
]
,
M
a
x
[
d
e
p
t
h
M
a
p
]
}
,
{
0
.
0
0
0
1
,
1
}
]
,
{
{
0
,
1
}
,
{
0
,
1
}
}
,
I
n
t
e
r
p
o
l
a
t
i
o
n
O
r
d
e
r
{
1
0
,
1
0
}
]
;
Plotting the Region:
I
n
[
]
:
=
r
p
=
R
e
g
i
o
n
P
l
o
t
3
D
[
z
≤
f
[
x
,
y
]
,
{
x
,
0
,
1
}
,
{
y
,
0
,
1
}
,
{
z
,
0
,
1
}
,
P
l
o
t
P
o
i
n
t
s
1
0
0
]
;
Discretizing the region plot:
I
n
[
]
:
=
D
i
s
c
r
e
t
i
z
e
G
r
a
p
h
i
c
s
[
r
p
]
O
u
t
[
]
=