Recti-Linear room simulator
For studying auditory localization and separation, it’s very important to have realistic spatial recordings. These can come from a number of sources, what I’ve been using in the past is a collection of impulse responses recorded through a KEMAR dummy in a real classroom. Each impulse response allows a sound to be simulated for one particular listener and source position in the room. While these are very realistic, they are time-consuming to record. The particular binaural impulse responses I’ve been using were recorded by Tim Streeter in Barbara Shinn-Cunningham’s lab at BU.
The next-best way to create spatial recordings is to simulate these binaural impulse responses. There are a couple of decent packages out there for doing this. Stephen McGovern’s rir is very fast, but only creates a bare-bones impulse response. Douglas Campbell et al.’s roomsim includes lots of features to make the impulse responses realistic, but it is very slow and can only be driven through a GUI.
I’ve written a new room simulator in the same spirit, but combining the best features of both of these. It’s called rlrs, short for “recti-linear room simulator” and you can download it here (3.6 MB). I’m releasing it under the GPLv3. Here’s the intro from the README:
This code will generate binaural impulse responses from a simulation of the acoustics of a rectilinear room using the image method. It has a number of features that improve the realism and speed of the simulation. It can generate a pair of 680 ms impulse responses sampled at 22050 Hz in 75 seconds on a 1.8 GHz Intel Xeon. It’s easy to run from within scripts to generate a large set of impulse responses programmatically.
To improve the realism, it applies anechoic head-related transfer functions to each incoming reflection, allows fractional delays, includes frequency-dependent absorption due to walls, includes frequency- and humidity-dependent absorption due to air, and varies the speed of sound with temperature. It also randomly perturbs sources in proportion to their distance to the listener to simulate imperfections in the alignment of the walls.
To improve simulation speed, it performs all calculations in the frequency domain and the complex exponential generation code is written in C, it only calculates the Fourier transforms of anechoic HRTFs as it needs them, and then it caches them, and it culls sources that are beyond the desired impulse response length or are significantly quieter than the direct path.