The image method, proposed by Allen and Berkley in 1979 [1], is probably one of the most frequently used methods in the acoustic signal processing community to create synthetic room impulse responses. A mex-function, which can be used in MATLAB, was developed 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 repository includes a tutorial, MATLAB examples, and the source code of the mex-function.
More information can be found here.
Below is a concise, platform-specific guide. First, follow the setup for your OS, then the common compile command.
- Install a supported MATLAB version (R2018b or later recommended).
- Install a supported C++ compiler, e.g.:
- Microsoft Visual Studio 2019/2022 with "Desktop development with C++", or
- Microsoft C++ Build Tools (standalone)
- In MATLAB, select the compiler:
mex -setup C++
- Compile using the common compile command below.
- Install a native Apple Silicon MATLAB (R2023b or later).
- Install Xcode Command Line Tools in Terminal:
xcode-select --install
- In MATLAB, configure the compiler:
mex -setup C++
- Compile using the common compile command below.
- Use an Intel MATLAB (e.g., R2020b or later) or run MATLAB under Rosetta on Apple Silicon.
- Install Xcode Command Line Tools:
xcode-select --install
- In MATLAB, configure the compiler:
mex -setup C++
- Compile using the common compile command below.
- Install GCC toolchain (e.g., build-essential on Debian/Ubuntu).
- In MATLAB, select GCC:
mex -setup C++
- Compile using the common compile command below.
Run this in MATLAB from the repository folder:
mex rir_generator.cpp rir_generator_core.cppResulting MEX extension by platform:
- Windows (x64):
.mexw64 - macOS Apple Silicon (ARM64):
.mexmaca64 - macOS Intel or MATLAB under Rosetta (x86_64):
.mexmaci64 - Linux (x86_64):
.mexa64
- 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.