5.0

5.0 | 6 ratings Rate this file 64 downloads (last 30 days) File Size: 1.9 KB File ID: #5116

Room Impulse Response Generator

by Stephen McGovern

 

06 Jun 2004 (Updated 27 Feb 2006)

Code covered by BSD License  

This program calculates the acoustical impulse response of a rectangular room

Download Now | Watch this File

File Information
Description

This function calculates a room's impulse response for an arbitrarily positioned sound source in an arbitrarily dimensioned rectangular room, as it would be heard at an arbitrary position. The output of RIR.m is a vector and can be used as an FIR filter to produce a reverb effect. To implement this filter you will need to do a fast convolution. I have another program, FCONV.m that performs this task. It is available on the Mathworks File Exchange.

For instructions on how to use this function, put RIR.m in your Matlab work folder and type "help rir."

The physics theory used by this function is not perfect. However, the function was intended to be used for space rendering in audio productions, and for this it works pretty well. For an article detailing the theory used go to http://www.steve-m.us/rir.html.
   
Some Additional Notes:

The following was taken from an email. It regards the input variable N.

"...During the computation, the end of the reverb tail gets cut off. The variable N relates to how long the tail is prior to the cut off. If N=6 then some echoes that have undergone more than 6 reflections and will be unaccounted for. Additionally no echoes that have undergone more than 3*N=18 reflections will be accounted for. You may use any value of N you like. However, small N may mean that the impulse response is shorter than the Sabine reverb time, and large N may mean that it is longer..."

As for the reflection coefficient R, I usually use a positive value. However, a negative value for R will produce an output that more closely resembles more traditional impulse response calculations.

MATLAB release MATLAB 5.3 (R11)
Other requirements Large values of N will use large amounts of memory. I have 256MB of RAM. I usualy just set N=10, and the calculation is finished in under a second.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
03 Feb 2006 Karin Vogt

Super good documentation togehter with a paper on the formulas

20 May 2006 Mark Cooke

very good IRs when used as audio processing for music.

27 Nov 2006 John Smith  
10 May 2007 Ismail Al Anshori

There's some restrictions in the physical modelling, but I think this is good enough.

10 Sep 2007 Jie Yang

It's so very useful for acoustic simulation.

13 Oct 2009 nguyen  
Please login to add a comment or rating.
Updates
10 Jun 2004

Fix a hyperlink in the m-file, clarify what the copyright symbol means.

12 Jul 2004

Fix a hyperlink in the m-file.

13 Jul 2004

Reference my paper.
Fix grammar.

09 Aug 2004

Want to see if removing the "screen shot" will increase number of downloads.

Add some notes.

29 Dec 2004

Add more to built-in help file in the M-file.

Correct an error in the description.

Add more to the description.

27 Feb 2006

Fix long standing errors.

27 Feb 2006

Change category

Tag Activity for this File
Tag Applied By Date/Time
audio processing Stephen McGovern 22 Oct 2008 07:22:27
video processing Stephen McGovern 22 Oct 2008 07:22:27
room Stephen McGovern 22 Oct 2008 07:22:27
impulse Stephen McGovern 22 Oct 2008 07:22:27
response Stephen McGovern 22 Oct 2008 07:22:27
reverb Stephen McGovern 22 Oct 2008 07:22:27
delay Stephen McGovern 22 Oct 2008 07:22:27
allpass Stephen McGovern 22 Oct 2008 07:22:27
iir Stephen McGovern 22 Oct 2008 07:22:27
fir Stephen McGovern 22 Oct 2008 07:22:27
acoustics Stephen McGovern 22 Oct 2008 07:22:27
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com