DSP Algorithms

Signal processing consultancy from algorithm
development to assembly optimization.

Room Impulse Response

Browse
Home
Consultancy
Publications
Download
Contact
Company
Partners
Products
Voice over IP
ASPT
Noise Reduction
Echo Cancellers
Sample Rate Converter
Room

Order Software
Request Information
Request Quotation
Feedback

Room Impulse Response v2.5

Copyright © DSP ALGORITHMS

room@dspalgorithms.com
Current Version : 2.5


1. Program Description

Room Impulse Response or simply Room is a Matlab program that calculates and displays the impulse response of a user specified rectangular enclosure. It has been developed using Matlab 5.x under Linux and thoroughly tested under Linux, Sun OS, and windows 9x/NT/2000. It should work fine under any other platform running Matlab 5.x or higher. Should you face any troubles running it, please report that to room@dspalgorithms.com . Although the program explains itself, it wouldn't be complete without documentation. A screen shot of the main program window is shown in fig.1. The main window might look different on your system. Note also that the software license has changed from January 2001, so please read the license agreement carefully.

  figure11

Fig.1: A snap shot of Room Impulse Response on X windows under Linux

2. Installation


  • Download the latest room package.
  • Unzip the file in a suitable place, it will create the directory dspalgorithms with the following files in it:
    • dspalgorithms\roomdemo\MakeRoom.p,
    • dspalgorithms\roomdemo\room25.mat,
    • dspalgorithms\roomdemo\spkr.mat,
    • dspalgorithms\roomdemo\room.p,
    • dspalgorithms\roomdemo\roominstall.p,
    • dspalgorithms\roomdemo\roomuninstall.p,
    • dspalgorithms\roomdemo\license.txt,
    • dspalgorithms\roomdemo\order.txt,
    • dspalgorithms\roomdemo\docs\room25.html,
    • dspalgorithms\roomdemo\docs\room.gif,
    • dspalgorithms\roomdemo\docs\img2.gif,
    • dspalgorithms\roomdemo\docs\img3.gif,
    • dspalgorithms\roomdemo\docs\img4.gif,
    • dspalgorithms\roomdemo\docs\img5.gif,
    • dspalgorithms\roomdemo\docs\img6.gif,
    • dspalgorithms\roomdemo\docs\line1.gif,
  • cd to this directory and run the roominstall script. This will add the room directory to the Matlab path. You need write permission to the 'pathdef.m' file in the Matlab distribution to be able to update the Matlab path.

3. Uninstalling Room

To uninstall room, simply type roomuninstall at the Matlab prompt. This will remove the room directory from Matlab path but will not delete any files. You need write permission to the 'pathdef.m' file in the Matlab distribution to be able to update the Matlab path.

4. Running Room

At Matlab prompt type the following then Enter

>> room

The GUI will appear quietly. You simply change any of the input parameters (described in section 4) leaving the rest at their default, and hit the calculate button. Room will calculate the impulse response you asked for and display the result in the three axes at the right. The impulse response is displayed in the top axis, the amplitude response in the middle and the phase response in the bottom axis. No variables appear in Matlab work space, all variables are stored in the Graphical User Interface (GUI), including the impulse response itself. You can obtain the result by hitting the save button and giving a file name. Room stores only two variables:

  • Imp, the impulse response just calculated.
  • Par, a string that contains Room version, the calculation date and time, and all input parameters used to calculate this response.

You can load these two variables in Matlab work space using the command

>> load filename

and check the variables in the work space using who

>> who

Your variables are:

Imp Par

5. Input Parameters

User parameters are divided to three parts, each part is displayed in a separate frame. These three parts are Room Parameters (see subsection 5.1) in the top frame, Source (speaker) and Receiver (microphone) Positions (see subsection 5.2) in the middle frame, and General Variables (see subsection 5.3) in the bottom frame. All variables with numerical values accept real values only. All parameters are in MKS system, so that lengths are in meters, speed of sound in meter/sec. and sampling frequency in Hz. The function of these parameters and variables are explained below

  • 5.1 Room Parameters

    • Room Dimensions: The length of the room in the x,y,z directions denoted tex2html_wrap_inline154,tex2html_wrap_inline156,tex2html_wrap_inline158 respectively.
    • Reflection Coefficients: Reflection coefficients of the inner surfaces of the room (4 walls, floor and ceiling).
    • Rev. time: The Reverberation Time for the given room parameters is calculated and displayed. Room does not calculate this value each time you change one of the above room parameters, it only calculates it when you hit the calculate button
    • Volume: The Volume for the given room parameters is calculated and displayed. Room does not calculate this value each time you change one of the above room parameters, it only calculates it when you hit the calculate button

  • 5.2 Source/Receiver Position

    Strictly speaking, there is nothing called an impulse response of a room. This impulse response is defined only from one point at which a sound source is excited to another point at which a microphone is placed to measure the response to this excitation. Therefore to be able to calculate this response, the position of the source and receiver have to be defined.

    • Source Position: The x,y,z coordinates of the source (speaker).
    • Source Position: The x,y,z coordinates of the receiver (microphone).

    Room checks to see if the coordinates entered are really inside the room, if not it displays an error message in the message window and uses a default value for the mis-entered coordinate. The default parameters are in the middle of the corresponding room dimension.

  • 5.3 General Parameters

    • Sampling Frequency: Defines the time interval after which Room calculates one sample of the impulse response. Choosing low Sampling Frequency and large Number of Samples increases the calculation time.
    • Number of Samples: Defines how many samples Room should calculate. The larger this value the longer the calculation time. See also Sampling Frequency
    • Sound Velocity: Velocity of sound propagation in the air filling the room. This velocity depends on the temperature and humidity, therefore it has been decided to make it a variable. At tex2html_wrap_inline174 it is about 345 meters/second. When Room starts, it has this value as a default.
    • Speaker: If this CheckBox is checked, Room will filter the impulse response calculated from the room model with a loudspeaker response. This gives results similar to measured impulse responses, which always include the measuring loudspeaker and microphone characteristics. Unchecking this CheckBox is equivalent to an equalized measurement (i.e. a measurement convolved with the inverse of the loudspeaker response). You can specify which .mat file Room should read the speaker response from. A measured response of the Realistic Optimus Pro 7 loudspeaker (obtained from ftp://sound.media.mit.edu/pub/Data/KAMER/headspkr.tar.Z) is stored in the file spkr.mat and used as a default.
    • Smooth: If checked, Room smooths the amplitude frequency response (after filtering with the speaker if Speaker CheckBox is checked). This is done by filtering half of the amplitude response by a low-time filter of pole specified in the edit box pole while keeping the phase unchanged. The other half is the complex conjugate of the first. This is sometimes helpful in interpreting simulation results performed with this impulse response.

6. Known Features

  • You are not able to resize the GUI window; this is done to keep the GUI elements intact. However, you can resize starting from version 2.3.
  • You are not able to get or set any properties of the GUI figure or any of its children; this is to protect the GUI from commands issued in Matlab work space.

7. Known Bugs

  • You might receive an error message if working with the mex version of recroom.p under Matlab version 6.0 and later. In this case, remove the recroom.dll file from the room directory.

Please report bugs directly to room@dspalgorithms.com.

8. Copyright

This program is NOT freeware. Before installing or using this software, read the license agreement very carefully. For more information on commercial license please email to legal@dspalgorithms.com.

9. MEX Files

Mex files have been removed starting from version 2.5. This has been done to improve maintainability. If you still want to use the mex files, please request an older version.

10. Command Line Version

You can also call the impulse response algorithm directly from the Matlab prompt. This can be handy if you want to generate many impulse responses automatically from a script or a function and use them subsequently. This can be done by calling the recroom function which returns the impulse response between two points in a rectangular room. The source image model is used to calculate the response.

>>help recroom

y = impresp(sv,fs,r,s,L,c,nsample)
Returns the impulse response between two points
in a rectangular enclosure.

sv == sound velocity in m/s
fs == sampling frequency
r == receiver position [x, y, z]
s == source position [x, y, z]
L == room dimensions [x, y, z]
c == reflection coefficients [x=Lx x=0 y=Ly y=0 z=Lz z=0]
nsample == number of samples to calculate

You can also call "clroom" to obtain the impulse response filtered through a loudspeaker response and smoothed by a first order recursive filter.

>>help clroom

[Imp, Par] = clroom(sv,fs,r,s,L,c,N,filtFlag,filename,smthFlag,pole)
Returns the impulse response between two points
in a rectangular enclosure and a string variable
with the parameters used to calculate the response.

sv == sound velocity in m/s
fs == sampling frequency in cycles/s
r == receiver position in m [x, y, z]
s == source position in m [x, y, z]
L == room dimensions in m [x, y, z]
c == reflection coefficients [x=Lx x=0 y=Ly y=0 z=Lz z=0]
N == number of samples to calculate
filtFlag == if 0, no speaker response is added.
filename == speaker response file.
smthFlag == if 0, no response smoothing is performed.
pole == recursive filter pole for response smoothing.

Example

sv = 345;
fs = 8000;
r = [1,1,1];
s = [2,1,1];
L = [3,3,4];
c = [0.9,.9,.8,.8,.7,.7];
N = 2048;
filtFlag = 1;
filename='spkr.mat';
smthFlag = 1;
pole = 0.8;
[Imp, Par] = clroom(sv,fs,r,s,L,c,N,filtFlag,filename,smthFlag,pole);
plot(Imp);
fprintf('%s',Par);

11. Downloading Room Demo

If you have read at least the Copyright section including the license agreement and you would like to try this software, Click here to proceed to the download page. .

12. Ordering ROOM

You can now purchase this software on-line. Move on to the software purchase page for more information.

13. References

This software is an implementation of the source image mode. This model is explained in details in many textbooks, papers, and applications and there is no need to mention the technical details here. Instead some reference are given for the interested reader.

  • Acoustics and Vibrational Physics, R.W. B. Stephens and A. E. Bate, Edward Arnold Publishers. Second Ed. 1966.
  • The Virtual Acoustic Room, William Grant Gardner, Master thesis, MIT, 1992.
  • Allen, J. B. and Berkley, D. A., Image method for efficiently simulating small-room acoustics, JASA Vol. 65, pages 943-950, 1979.


Copyright © 2000-2003, DSP ALGORITHMS, All rights reserved.
Last updated October 2002.