Room Acoustics Impulse Response Generator using the Randomized Image Method (RIM)
21 Stars
Updated Last
2 Years Ago
Started In
March 2015

Image Method Reverb

DOI Build status codecov.io

Acoustic Room Impulse Response (RIR) generator using the (Randomized) Image Method for rectangular rooms. Can be used to make audio signals reverberant.


To install the package, hit ] from the Julia command line to enter the package manager, then

pkg> add ImageMethodReverb


Import the package by typing using ImageMethodReverb and specify properties of the room of interest:

using ImageMethodReverb, Random
Fs = 8e3          # sampling frequency
L = 4.,5.,3.      # room dimensions in meters 
T60 = 0.7         # reverberation time

If the reverberation time is given, all the walls will have the same reflection coefficient. Alternatively it is possible to manually change this
using a six element Tuple:

β = (0.9,0.9,0.7,0.7,0.8,0.8) 
#(  βx1     ,    βx2   ,    βy1   ,    βy2    ,  βz1 ,   βz2  )
#(front wall, rear wall, left wall, right wall, floor, ceiling)

Once the properties of the room are given, select your source and microphone position:

xs = (0.5, 0.5, 0.5)          #src pos (in meters)
xr = (Lx-0.1, Ly-0.3, Lz-0.2) #mic pos
Nt = round(Int,Fs/2)          #time samples (1/5 sec)

Now type:

h, = rim(xs,xr,L,T60,Nt,Fs)

to obtain your room impulse response.

You can also use multiple microphone position by providing an array of Tuples containing the microphone coordinates.

h, = rim(xs,[(1,1,1),(1,1.5,1)],L,T60,Nt,Fs)

Here h will consist of a matrix: h[:,1] will be the RIR relative to the microphone in (1,1,1) etc. It is also possible to specify the source signal to directly obtain the sound pressure at the microphones:

s = randn(Nt)   #src signal 

and type:

p, = rim(s,xs,[(1,1,1),(1,1.5,1)],L,T60,Nt,Fs)

Type ?rim for more details. By default the randomized image method from [1] is used. The original image method proposed in [2] can be reproduced as well by turining off the randomization and fractional delays.

Other languages implementations

A MATLAB implementation of the Randomized Image Method can be found here.