Site menu:

Room Impulse Response Generator for MATLAB

Abstract

The image method, proposed by Allen and Berkley in 1979 [1], is probably one of the most commonly used methods in the acoustic signal processing community to create synthetic Room Impulse Responses. A mex-function, which can be used in MATLAB, has been created to generate multi-channel Room Impulse Responses using the image method. This function enables the user to control the reflection order, room dimension and microphone directivity. This package includes a short tutorial, some MATLAB examples, and the source code.

References

  1. J.B. Allen and D.A. Berkley
    Image method for efficiently simulating small-room acoustics
    Journal Acoustic Society of America, 65(4), April 1979, p 943.

Example

c = 340; % Sound velocity (m/s)
fs = 16000; % Sample frequency (samples/s)
r = [ 2 1.5 2 ]; % Receiver position [ x y z ] (m)
s = [ 2 3.5 2 ]; % Source position [ x y z ] (m)
L = [ 5 4 6 ]; % Room dimensions [ x y z ] (m)
n = 4096; % Number of samples
beta = 0 . 4; % Reverberationtime (s)
mtype = ’ hypercardioid ’; % Type of microphone
order = −1; % −1 equals maximum reflection order!
dim = 3; % Room dimension
orientation = pi / 2; % Microphone orientation (rad)
hp_filter = 1; % Enable high-pass filter

h = rir_generator(c, fs, r, s, L, beta, n, mtype, order, dim, orientation, hp_filter);

History

1.0.20030606

Initial version

1.1.20040803

+ Microphone directivity
+ Improved phase accuracy

1.2.20040312

+ Reflection order

1.3.20050930

+ Reverberation Time

1.4.20051114

+ Supports multi-channels

1.5.20051116

+ High-pass filter [1]
+ Microphone directivity control

1.6.20060327

+ Minor improvements

1.7.20060531

+ Minor improvements

1.8.20080713

+ Minor improvements

Download

Latest version (including source code and tutorial)

Note: If you are using any MATLAB version prior to R2008a please use the dll file enclosed in this archive.

Tutorial (Recently, the tutorial has been considerably improved!)

Copyright

Copyright (C) 2003-2008 E.A.P. Habets, The Netherlands.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA