Edge Diffraction Toolbox by Peter Svensson


This toolbox contains a set of Matlab functions that calculate the impulse response for a point source in an environment of rigid, plane surfaces. Specular reflections (any order) and edge diffraction components (up to sixth order) are included, also combinations of them to some extent.

A single program, EDBmainISESx, does all the calculations. It creates a number of intermediate result files, but also a final output file where impulse responses (total IR, direct sound IR, specular reflection IR, diffraction IR) are stored. Many sources and receivers can be run as a batch job, and one output file is stored for each source-receiver pair.

The final IR could be transformed to a frequency response using FFT. The IR can also be convolved with any source signal to get the sound pressure signal in a receiver position. Also, animations of sound propagation can be created quite easily by specifying a regular mesh of receivers and plot the instantaneous sound pressure time step by time step. Such instantaneous plots can then be put together into a movie using Matlab’s movie command.

The calculation method use two distinct steps:

1. All valid reflection/diffraction paths are found. Here, the classical image source method [Borish 1984], is used, with extensions for edge diffraction [Torres et al 2001].

2. Each valid path generates an impulse response which is added to a total IR. Specular reflections give a pulse whereas diffraction IRs uses the expressions in [Svensson et al 1999] and [Svensson and Calamia 2006].

As described in the section on Calculation steps below, the intermediate output files makes it relative straightforward to use your own alternative method for any of the steps, as long as you generate a file which contains the right variables. In the setup file it is possible to specify, as an option, any input file with your own filename instead of the automatically generated ones: xxx_eddata for instance.

Calculation Time/Memory Usage

The code uses vectorizing to a very large degree in order to speed up the processing. This has the drawback that large matrices are created as intermediate variables inside some of the programs, especially EDBSorRgeo, EDBedgeo2x and EDBfindISEStree. There are some possibilities to limit the vectorizing in the EDBSorRgeo and introduce for-loops but there are no such easy possibilities for the EDBedgeo2x and EDBfindISEStree files. Consequently, higher than order 6 for specular reflections often leads to the “Out of memory” message even for small models. The file called xxx_ISEStree.mat contains all the valid image sources and edge sources (that is, those that are on the right side of the last reflection plane) but visibility (that is, a check if the hit points are inside the finite planes) and obstruction (a check if there is no obstructing plane for any of the paths) is not tested until the program EDBfindpathsISESx is run. Therefore, the “ISEStree” is very large, and some huge matrices are not transferred via a file between the EDBfindISEStree and EDBfindpathsISESx programs but rather via global variables.

The use of a beam tracing algorithm would make these steps much more efficient than the present implementation because the ISEStree could be reduced to a very large degree.

The calculation of the IRs is also somewhat time consuming but it should be noted that the calculation time depends on the sampling frequency chosen. Also, there is a compiled mex version available for Mac OSX for which the generation of first-order diffraction IRs is about twice as fast as the Matlab version.


All these programs are offered under the GNU GPL license.

To my best knowledge, the programs implement the algorithms as intended, but I can not guarantee that they are bug free. I will do my best to correct bugs when they are found but I can not make any guarantees for that either.

Anyone who finds bugs is very welcome to let me know and I will try to take care of them as best as I can. Suggestions for extensions/improvements are also very welcome.


A few benchmark examples are collected at http://www.iet.ntnu.no/~svensson/Benchmarks/index.html. You can compare your results with those presented there.

Borish, J., “Extension of the image model to arbitrary polyhedra,” J. Acoust. Soc. Am. 75, 1827-1836 [1984].

Svensson, U. P., Fred, R. I., Vanderkooy, J., “An analytic secondary source model of edge diffraction impulse responses,” J. Acoust. Soc. Am. 106, pp. 2331-2344 [1999].

Torres, R. R., Svensson, U. P., Kleiner, M., “Computation of edge diffraction for more accurate room acoustics auralization,” J. Acoust. Soc. Am. 109, pp. 600-610 [2001].


Edge Diffraction Toolbox for Matlab


Peter Svensson, Acoustics Group, NTNU Trondheim, Norway

Comments are closed.