Image-source method: Matlab code [old version!]
Summary and disclaimer
As explained in the Background section, the Matlab code provided below is a first attempt at implementing Allen & Berkley's image-source method (ISM) for small-room acoustics , using frequency-domain simulations (i.e., Peterson's low-pass impulse method ). The Matlab programs available below are still fully functional, and many researchers have been using similar implementations of the ISM technique for their acoustics and/or engineering experiments. The pieces of code on this page are thus still provided for compatibility purposes, for anyone who would like to use a direct implementation of Allen & Berkley's method.
Following our research on room acoustics modeling, however, we came up with an improved implementation of the image-source model for the simulation of room impulse responses . This updated method has a few advantages, including the ability to simulate impulse responses that look more realistic, and the ability to provide a relatively good prediction of the response's energy decay over time (see  for details). The updated Matlab code for this improved technique can be found here, and should be used instead of the programs below due to the above mentioned advantages.
As usual, feel free to download and use the files below 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. And of course, an acknowledgement will be deeply appreciated if you happen to publish results based on the code provided below!
Image-source code [old version!]
The following Matlab files provide an implementation of Allen & Berkley's image-source technique (see  for more technical information) and can be used in a straightforward manner to generate samples of audio data using the image-source simulation method. An example of how to generate the impulse responses and audio data can be found below the table, and more specific implementation and usage information can be found in the Matlab help section for each of these files. Also, some of these Matlab files might require additional general-purpose functions which can be found further below.
The files above make it quite easy to generate samples of audio data using the image method for any simulation setup. Start by creating/editing a setup file, e.g. myIMSetup.m, similar to IMSetup.m above. Then determine an estimate of the reverberation time for the current setup in Matlab:
>> IMRevTimeAnalysis('myIMSetup');Once this is done, simply execute the following two commands:
>> MakeTrajIMTFs('myIMSetup','myIMSetup_TFs');The first command saves the TF bank into the file myIMSetup_TFs.mat, and the second one writes the resulting data into myIMSetup_audio.mat. The variable AuData is the resulting matrix of audio data, each column containing the data generated for the corresponding microphone with the setup described in myIMSetup.m. This .wav sample (600kB) of audio data was generated using the above commands for a source moving from left to right in front of a 2 microphone array in a room with a reverberation time of approximately 0.4 s (stereo signal, each channel contains the signal recorded by one microphone; try listening to it with headphones...).
>> AuData = MakeAuData('myIMSetup_TFs','myIMSetup_audio',SourceSignalVec);
The table below contains a list of various custom functions that may be required by the Matlab files described above. See the files' help section for specific usage information. Also, please let me know if a function is missing from the list below.