Fast image-source method: Matlab code

Summary and disclaimer

The Matlab files on this page provide an implementation of the fast image-source method (ISM) described in [1] for the purpose of simulating reverberant audio data in small-room acoustics. Refer to [1] or see the explanations given further below on this page for more detailed information on how this fast ISM algorithm is implementated. A typical example of audio samples generated with this method (compared with those obtained using a standard ISM implementation) can also be found here. The next section provides a typical example of how to use the Matlab functions provided on this page. Note that these files can also be downloaded from the MathWorks website.

As per usual, simply download and use these files as you like, but remember that all material available on this page is subject to the GNU general public license and comes with NO WARRANTY whatsoever! Please don't hesitate to contact me if you find any bug or if you have interesting suggestions to make.

Also, the method implemented in the Matlab code below effectively represents an approximation of the reverberant tail in room impulse responses. This in turn leads to some limitations in practice (see [1] or further below for more information on this). For a majority of applications however, the code below should allow users to generate proper ISM-based results in a very efficient manner. I am particularly interested to hear from you if you happen to make use of this code, so please feel free to drop me a line and let me know about your results. Thanks!

Fast image-source code

The Matlab functions provided on this page contain the implementation of the fast ISM algorithm. They can be used in the same manner as the files made available previously on this website (see the standard ISM page, for instance).

Typical Matlab usage:
  1. Create a setup file for the simulation, e.g.: my_ISM_setup.m (similar to the example ISM_setup.m)
  2. Create a 1D vector of source signal data, e.g.: SrcSignalVec = wavread('speech.wav')
  3. Simply execute the following two Matlab commands:

    >> fast_ISM_RIR_bank(my_ISM_setup,'fastISM_RIRs.mat');
    >> AuData = ISM_AudioData('fastISM_RIRs.mat',SrcSignalVec);

The first command fast_ISM_RIR_bank(...) will create and save a bank of RIRs into the file fastISM_RIRs.mat. The second command ISM_AudioData(...) takes the .mat file and the source signal vector as inputs, and computes the sensor data AuData by convolution (overlap-add). This function also offers the possibility to write the resulting audio into a .wav or .mat file. The resulting audio data is a matrix where each column contains the signal generated for the corresponding microphone. Of course, the same process can also be used if the source remains stationary and/or in environments containing only one sensor: simply define the simulation parameters accordingly in the setup file my_ISM_setup.m!

The Matlab functions required by the above process are listed in the following table. Several other functions are necessary for a proper execution; these additional files are described in more detail on the standard ISM page.

Additional files required by the functions below (same as those provided on the standard ISM page): and
Download all the files below in a .zip file:
fast_ISM_RoomResp.m Computes the RIR between a source and a receiver in a given simulation setup, using the fast image-source method described in [1]. This implementation generates the early reflections using the standard ISM algorithm described in [2], while the late reverberation phase is computed as random noise decaying according to the predicted energy-decay curve for the given environment. An example RIR obtained with this implementation can be found further below on this page.
fast_ISM_RIR_bank.m Computes a bank of RIRs (corresponding to a simulation setup defined in a file such as ISM_setup.m) according to the fast ISM method implemented in fast_ISM_RoomResp.m. One impulse response is computed for every possible combination of the sensors and source trajectory points.
ISM_vs_FastISM_demo.m  Demonstration file displaying some typical RIR results from the fast ISM implementation (fast_ISM_RoomResp.m) as well as the same results obtained using the standard ISM simulation (ISM_RoomResp.m). This function randomly selects a room setup and plots each RIR example (and its EDC) in a figure for comparison purposes.
Generates random samples distributed according to the logistic PDF.

List of changes

Check the table below to see which of the files above have been updated and to make sure that you have the latest version available.

Date Summary of changes
10 Mar. 2012 Minor update to fast_ISM_RoomResp.m so as to better handle anechoic environments (thanks to comments from Maryam Naghibolhosseini). Anechoic responses can now be achieved by setting either RT_VAL=0 or BETA=[0 0 0 0 0 0] (or both).
30 Jan. 2010 Small bug fixed in fast_ISM_RoomResp.m (could occasionally lead to the last value of a RIR being NaN instead of a correct value). Thanks to Marius Hennecke for this!


The details of the fast ISM method implemented in the code provided above can be found in [1]. In short, this approach relies on the fact that the diffuse tail of typical RIRs have a distinctive noise-like character. The early reflections in the RIR are thus simulated according to the standard ISM algorithm [2], and the late (diffuse) reflections are generated using a decaying random noise model.

The exact decay of energy in the RIR typically depends on the considered environmental setup, and is computed here according to the EDC prediction formula described in [2]. Furthermore, it was found that the RIR values in the diffuse (late) section of ISM-simulated RIRs are typically distributed according to the logistic distribution. The Matlab code provided above takes all these observations into account, and thus produces RIRs with a proper energy decay (for the considered setup) and a correct statistical distribution of the diffuse RIR values.

A significant advantage of the decaying random noise model used here is that the image-source simulations are only carried out for the early section of the RIR. This drastically reduces the required computational effort and the RIR simulation times can be decreased by up to two orders of magnitude (compared to a full-ISM simulation).

The figure below provides a typical RIR example obtained with the fast_ISM_RoomResp.m code. It also provides the result obtained using the standard ISM simulation algorithm (ISM_RoomResp.m) for comparison purpose. Both RIRs were obtained for the same simulation setup (sensor and source positions, room dimensions, reflection coefficients, etc.) defined as an environment with T60≈0.5s. It can be seen that both RIRs are virtually identical; this observation is also validated when considering the energy decay curves, which only differ by a very small amount.

Figure 1: RIR examples (and their EDCs) obtained with the standard and fast ISM implementations.

Note however that the diffuse field model used here is only an approximation based on the predicted average tail decay. Therefore, some particular RIRs cannot be properly modeled with the above technique, such as when the energy decay pattern is rather irregular (non-smooth). This is typically the case in environments exhibiting a very uneven distribution of the sound absorption among the walls. In such cases, a full-ISM simulation is therefore necessary in order to obtain accurate results (i.e., the Matlab function ISM_RoomResp.m must be used instead). Note also that the above Matlab functions will automatically check the environmental parameters provided as input in order to detect whether such an irregular decay pattern is likely to occur. In such cases, the user will be warned with an appropriate message on screen and/or a warning flag will be set accordingly.

A comparison of typical audio samples generated with the standard ISM and the above algorithm can also be found here.


[1] E. Lehmann and A. Johansson, Diffuse Reverberation Model for Efficient Image-Source Simulation of Room Impulse Responses, IEEE Transactions on Audio, Speech and Language Processing, vol. 18, no. 6, pp. 1429-1439, August 2010.
[2] E. Lehmann and A. Johansson, Prediction of energy decay in room impulse responses simulated with an image-source model, Journal of the Acoustical Society of America, vol. 124(1), pp. 269-277, July 2008.