Imagine that you are blindfolded inside an unknown room. You snap your fingers and listen to the room’s response. Can you hear the shape of the room? Some people can do it naturally, but can we design computer algorithms that hear rooms? We show how to compute the shape of a convex polyhedral room from its response to a known sound, recorded by a few microphones. Geometric relationships between the arrival times of echoes enable us to “blindfoldedly” estimate the room geometry. This is achieved by exploiting the properties of Euclidean distance matrices. Furthermore, we show that under mild conditions, first-order echoes provide a unique description of convex polyhedral rooms. Our algorithm starts from the recorded impulse responses and proceeds by learning the correct assignment of echoes to walls. In contrast to earlier methods, the proposed algorithm reconstructs the full three-dimensional geometry of the room from a single sound emission, and with an arbitrary geometry of the microphone array. As long as the microphones can hear the echoes, we can position them as we want. Besides answering a basic question about the inverse problem of room acoustics, our results find applications in areas such as architectural acoustics, indoor localization, virtual reality and audio forensics.

First, open a working distribution of **MATLAB**. Then, compile the file `dist_opt_mex_3d.c`

by typing the following

```
>> mex dist_opt_mex_3d.c
```

To get the "sorted" echoes, do the following

```
>> [images, loudspeaker, microphones, ~] = run_experiment(experiment);
```

with `experiment`

taking one of the three following values:

- experiment = 1: omnidirectional loudspeaker, classroom
- experiment = 2: directional speaker, classroom
- experiment = 3: cathedral portal

From these sorted echoes we can get the room geometry by discarding the higher-order image sources. To do so, run the following

```
>> [A, b, V] = prune_echoes(images, loudspeaker, 2, As, bs);
```

For Experiment 1, set `As = []`

, `bs = []`

.

For Experiment 2 we used a directional loudspeaker, and we don't hope to reconstruct the wall directly behind the loudspeaker. We can take this into account by setting:

```
>> As = (loudspeaker - microphones(:, 5))' / norm(loudspeaker - microphones(:, 5));
>> bs = dot(As', loudspeaker + As' * 0.1);
```

This will communicate to `prune_echoes()`

to disregard any image source `x`

not satisfying the inequality `<As, x> <= bs`

. The inequality is setup so that it roughly means "*discard everything behind the loudspeaker*".

To visualize the result you can use the following code:

```
>> figure; clf; hold all;
>> scatter3(V(:, 1), V(:, 2), V(:, 3), 'r*'); % room vertices
>> scatter3(microphones(1, :), microphones(2, :), microphones(3, :), 'k>', 'filled');
>> scatter3(loudspeaker(1), loudspeaker(2), loudspeaker(3), 'bo', 'filled');
>> view(3); axis equal; grid on;
>> legend('Room vertices', 'Microphones', 'Loudspeaker');
```

Note that the result will be correct up to a rotation and a reflection. We could rotate and mirror it into an "absolutely correct" orientation if we assume, for example, the knowledge of the floor reflection and the microphone array orientation.

In Experiment 3, as described in the paper, the "room" does not satisfy the assumptions of it being a convex polyhedron, thus it makes no sense to use the function `prune_echoes()`

. The following distances correspond to the dimensions of the portal:

```
>> norm(images(:, 6) - images(:, 20))/2
ans =
6.7587
>> norm(loudspeaker - images(:, 22))/2
ans =
6.2751
```

To this last distance, we must to add the distance of the acoustic center of the loudspeaker to the back wall (a bit more than 20 cm) to get the dimension. In terms of angles, walls 6 and 20 are esentially parallel, but wall 22 is not exactly perpendicular to them. A probable reason is that in echo sorting, echoes from wall 22 received by 4 microphones were combined with a different echo off an obstacle received by the 5th microphone (since the true one is missing).

- Microsoft Windows 8, with MATLAV R2014b

This code uses functions `lcon2vert`

and `vert2lcon`

available here.

In addition, the function `distance`

is available here.

Copyright (c) 2013, Ivan Dokmanic, Reza Parhizkar, Andreas Walther, Yue M. Lu and Martin Vetterli

This code is free to reuse for non-commercial purpose such as academic or educational. For any other use, please contact the authors.

Time Domain Acoustic Rake Receiver by Robin Scheibler, Ivan Dokmanić, Martin Vetterli is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Based on a work at https://github.com/LCAV/AcousticRakeReceiver.

Comment | Rating | Date |