Room Acoustics Analysis

This page summarizes the process of determining the reverberation time for a room using a laptop computer, microphone, preamplifier, amplifier and speaker.  The software for performing the analysis consists of a mix of a number of programs, all which are free or open-source.  Hopefully enough documentation is provided here to enable others to use the same process.  If incomplete or errant information is found on this page, please contact the author for clarification or correction.

Index

Reverberation Time

Reverberation time, RT, is a measure of the decay of acoustic energy within a room once the source is discontinued.  It is defined as the time it takes the sound level to go from 60 dB to 0 dB (threshold of hearing).  The sound level is related to the amplitude of the pressure wave by the relationship Lp = 20 log(p/po), where po is the pressure amplitude at the threshold of hearing.  Assuming 1) the sound field is diffuse (random phase between waves due to multiple reflections within the room) and 2) the absorption coefficients are not dependent on the intensity of the sound, the reverberation time can be related to a time constant for exponential decay, τ, through the equation p=poe-(t/τ).  Combining these two equations and using Lp = 60 dB, the relationship between tau and the reverberation time becomes

RT = 6.9 τ

Theoretically, the reverberation time can be calculated using the room volume and the absorption coefficients for different surfaces within the room.  The formula for calculating reverberation time, developed by Sabine, is

RT = 0.161 V/Σ(αi Si)

where V is the volume in m3, S is the area of a surface in m2 and α is the absorption coefficient of that surface.  Since each surface could have a different absorption coefficient, there is a summation with respect to the subscript i.  Absorption coefficients for different surfaces can be found at http://hyperphysics.phy-astr.gsu.edu/HBASE/Acoustic/revmod.html#c4

Equipment

The equipment needed to measure reverberation time consists of a laptop, microphone, preamplifier, amplifier and speaker.  There is also a need for audio cables and adapter plugs.

Laptop

A laptop with a microphone input and headphone output is needed to make this measurement.  The laptop was running WinXP, but with adaptation of the software and procedure it should be possible to make this measurement with an Apple or Linux system.

Microphone

A dynamic microphone with low and high impedance input setting was used for this procedure.  The high impedance setting of 15k ohm was too sensitive.  The low impedance 800 ohm setting was less sensitive and required a louder output from the speaker system before clipping by the sound recorder.  This allowed the sound from the speaker to drown out background noise during the measurement.  When measurements were close to clipping with this arrangement, the sound level in the room was around 85 dB.

I tried several microphones designed for computers to make this measurement, however, their sensitivity was too low.  They are designed to pick up the voice of the speaker without interference from background noise.  This is inexpensively accomplished by using a low sensitivity microphone and placing it close to the mouth.  Since we are measuring background sound, the speakers would need to be set at an unreasonably loud level, 110+ dB.  This would be very disruptive to people near the room being measured and uncomfortable for those making the measurement.

Preamplifier

Dynamic microphones are not designed to deliver line-level voltages expected by audio cards.  Therefore, a preamplifier needs to be connected between the microphone and the laptop.  If you are using a small mixer board or a stereo receiver with tape deck as your amplifier, you most likely have a 1/4" microphone jack available.  If this plug-in jack is available, your board has a preamp built in and you can feed the output of the microphone from the board to the microphone input of the laptop.  Since the microphone input for the laptop is a 1/8" mono mini jack, you will need the appropriate cable to attach the board to the laptop.
If your amplifier does not have a built-in preamp (as in my case), you need to purchase a separate preamplifier.  These used to be readily available at Radio Shack; however, I found it very difficult to find any preassembled preamps anywhere.  However, there are a number of mail-order companies that have mono preamp kits available.  I picked up my kit at an electronics surplus store and assembled it in about an hour.  It requires a 9 volt battery and does not provide any connection jacks.  To make the kit complete and your preamp somewhat resilient, I would suggest you purchase a small plastic box, an input jack for your microphone, an output jack for your patch cord running from the preamp to the laptop, an on/off switch for the battery and a 9V battery connector.  All of these should be available at the electronics store where you purchase the preamp kit.  They should also be available at Radio Shack stores. 

Amplifier

The amplifier boosts the power of the audio signal coming out of the speaker port of the laptop.  A relatively inexpensive amplifier from a home stereo is sufficient.  I used the 50 watt per channel receiver/amplifier from my home stereo system and it worked fine.  Although I did not measure the power output during measurements, I would assume that 25-30 watts of power per channel will be sufficient.  I did not try using computer speakers for measurements because they will not provide sufficient power.  However, if you have some high-power computer speakers (with a built-in amplifier), you might want to give it a try.

Speaker

Ideally you should use a cluster of speakers that emit sound of equal intensity in all directions.  However, reasonable results were obtained using a single speaker that provides a somewhat flat response to a wide range of frequencies.  The speaker I use is a bass-reflex 60 watt speaker with a tweeter.  Speakers are rated by the maximum power they can handle.  However, when driven near the max range, there is an increased amount of distortion.  Therefore, it is best to use a speaker that is rated well beyond the power level desired for operation.

Software

The software used for this system was a combination of several programs.  Originally I attempted to use ACMUS, which is freely available through http://www.sourceforge.net.  However, this program uses stereo input when recording.  The one channel is a direct feed of the audio output file and the other is the microphone pick-up from the room's response to the amplified audio output file.  When using this program, it is assumed that the amplifier, speaker and microphone have a flat response through a range of frequencies.  ACMUS then generates an impulse response function comparing the two channels from the input.  From the impulse response, a number of room acoustic properties can be calculated, one of which is the reverberation time.
When using this program with my equipment, several problems arose.  First, the laptop only has a mono input for the microphone.  This can be resolved by using a computer with a sound card.  Sound cards have an input jack called 'line', which is stereo.  The second problem was more critical.  When measuring the response of a room, I noticed a significant change in recorded intensity at different frequencies.  Setting the microphone directly in front of the speaker, I repeated the process.  I noticed that the frequency dependent intensity was still present, which meant that my microphone and speaker have a significant frequency dependence.  Therefore, the impulse response function calculated by ACMUS was more characteristic of my measurement system than of the room itself.
Since I do not want to invest in an expensive microphone/speaker system, I have implemented several other programs to assist in my measurement of the reverberation time of a room.  They are AudioEdit, a home spun Java program, and R, an open-source statistics package.

ACMUS

As mentioned previously, this is an open-source program and is freely available through http://sourceforge.net/projects/acmus/.  It measures the response of a room to an acoustic impulse or to a frequency sweep from 20 - 20k Hz.  The computational aspects of this program were developed using MatLab and a number of MatLab scripts are included with the source code.  The program is written in the Java language and its interface uses code from the Eclipse Project.  If you are familiar with the Eclipse programming environment, then the interface for ACMUS will be very intuitive.

When you start up the program, it will ask for the location of your workspace.  This allows you to have multiple locations on your hard drive, flash drive, etc. that contain your measurement projects.  Once a workspace is open, you can open a new measurement project or import one from a location different than your workspace.  Once you complete a measurement project, you can export its files to a new location or compress them into a ZIP archive.  Once a project is open, you can set up a new measurement session and a new signal.  Within the measurement session, you can set up a new measurement set and in turn a new measurement.  This tiered directory within the project may seem a bit of overkill; however, it allows you to input information about your measurement equipment, the room dimensions and the positioning of the microphone and speaker within the room.

I am currently using ACMUS in a very limited fashion.  I am using it to play an audio file over the laptop speaker while recording the input from the microphone.  In the future, I will explore an expanded use of ACMUS because the built in documentation of the  measurement process is very useful.  In the short term, I will modify the program AudioEdit to perform the simultaneous playing and recording of audio files to eliminate this tedious step of the measurement process.  However, until this capability is incorporated in AudioEdit, the following steps must be completed.

Once a measurement project has been set up, a sweep signal must be set up in ACMUS.   Since ACMUS does not let you import custom audio files, you need to fool it into using the audio file you generate using AudioEdit.  You need to close the measurement project and exit the program ACMUS.  Using your operating system's file manager, go to the location of your project's workspace.  You should find the name of your measurement project.  From the project directory go to the directory ".\_signals.signal\audio."  The file "LogSineSweep_6s_20-20000Hz.wav" will be located in that directory.  Replace this file with your audio file, using the same name.

Once you make the file swap, open up your project in ACMUS.   Follow the instructions provided by ACMUS to set up measurement sessions, measurement sets and new measurements.  Once you have recorded a measurement using your custom audio file, you will find a file named "recording.wav" in the directory for each measurement set.  This file is then used to calculate the reverberation time.

AudioEdit

AudioEdit is written in Java and is currently used to convert file formats.  This program allows you to load and save audio files in three different formats.  The first format is WAV, which is used by ACMUS.  The second format is TXT, which is an ASCI dump of the audio data, where each data point is on a separate line and the left channel is saved first followed by the right channel (if the file is in stereo).  The third format is BNR, which is a binary integer dump of the audio data with the left channel saved first followed by the right channel.  AudioEdit recognizes WAV and TXT files by their extensions and will load and save files with the appropriate format based on the provided extension.  If the extension is wrong, the file will fail to load.  If an extension of ".wav" or ".txt" is not used, then the program will assume a binary integer format.  BNR and TXT files do not contain format information.  Therefore, you will need to specify the number of channels, bit rate and resolution of the data being loaded.  The length of the file and the number of channels will allow AudioEdit to successfully load in all of the data.  If this file is then saved as a WAV file, this information is incorporated into the header of that file.

AudioEdit is used two times in the measurement process.  The first time is to convert a custom audio file from a TXT format into a WAV format.  In this case, just load the TXT file and use the default values for the file information (16 bit resolution, 1 channel, 44100 sample rate).  Next chose "Save As" and use the file name "LogSineSweep_6s_20-20000Hz.wav".  This file can then be swapped for the one used by ACMUS (see instructions above).  The second time is to convert the file "recording.wav" obtained from the measurement process into a mono TXT file.  This is accomplished by loading "recording.wav" and choosing the option "Split", which is located under the menu item "Modify".  This saves the stereo file as two separate channels.  The left channel is saved in a BNR format with an ".L" extension and the right channels is saved with an ".R" extension.  Next load in the file "recording.wav.L" and use the default file information.  For this example save the file as "Pulse1k.txt".  The ".txt" extension will save the file in an ASCI format, which is usable by the program 'R'.  'R' will perform the statistical analysis on the audio file and provide our reverberation time.  Any file name can be specified in this step of the process as long as it ends with ".txt".  In the later instructions, it is assumed that the TXT conversion of "recording.wav" from the 1 kHz signal is named "Pulse1k.txt", likewise "Pulse500.txt" for the 500 Hz signal, "Pulse2k.txt" for the 2 kHz signal and "Pulse4k.txt" for the 4 kHz signal.

In the future AudioEdit will be expanded to play and record audio files.  When this is done, then the need for ACMUS will be eliminated.  Also it is possible to call 'R' as an external function.  It should be possible to evaluate the 'R' script from within AudioEdit and, therefore, perform the measurement and analysis of a room from within AudioEdit.  The current version of AudioEdit can be obtained by saving the file at the following link (AudioEdit).

R Project

The R project is an open source program and collection of plug-ins for performing statistics.  The plug-in and extensions can be obtained at http://www.r-project.org.  This program is used to generate custom audio files.  After installing this program, you start the program and change the working directory.  To do this select "Change Dir" under the "File" menu item.  Change the directory to the location of your audio project.  This directory should contain the R script needed to generate different audio files as well as the files needed to perform your data analysis.  When using ACMUS and AudioEdit, you need to access files and place files in this directory.  Since AudioEdit uses its own directory by default, you should place AudioEdit in this directory too.  Any files generated in this directory can be moved to the appropriate ACMUS directory and any file generated by ACMUS can be moved to this directory for additional processing.

Generating custom audio files

A number of different audio files were generated to analyze the room acoustic properties.  Since absorptive properties of surfaces change for different frequencies, it is necessary to test the room at a number of frequencies.  The room was analyzed at 500 Hz, 1k Hz, 2k Hz and 4k Hz.  To do this the R script "GenAudio1k.R" is loaded into 'R' and the option "Run All" under the menu "Edit" was selected.  Upon successful completion of this script, the file "Pulse1k.txt" is generated.  This can then be converted to a ".wav" file by AudioEdit and then used by ACMUS.  To generate the other frequencies, modify the 4th line which states "f <- 1000" to "f <- 500" for 500 Hz, "f <- 2000" for 2k Hz, and "f <- 4000" for 4k Hz.  Before running the modified script, you can modify the last line "write( final, file="Pulse1k.txt", ncolumns = 1 )" so the saved file is "Pulse500.txt", "Pulse2k.txt" and "Pulse4k.txt" respectively.  Each of these files consist of 1/2 second of silence, 5 seconds of the pure tone followed by 1/2 second of silence.  The pulse does not instantaneously turn on, but is turned on and off with an exponential time constant of 15 milliseconds.

When analyzing a room with these pure tones, it is found that standing waves are established and the assumption of diffuse acoustic energy is no longer valid.  To minimize the effect of standing waves, a range of frequencies must be generated.  This is done two different ways.  The first is to use a warble that varies the frequency 1/2 octave about the central frequency.  The second is to generate white noise and filter it so that only frequencies 1/2 octave on each side of the central frequency remain.  The R scripts used to generate these different audio files are the following:

Links to relevant R-scripts for generating different tones

Analyzing Audio Files

Once the left channel of "recording.wav" is save in TXT format by AudioEdit, it is possible to determine the exponential decay constant of the sound field.  The R-script "AudioAnalysis1k.R" should be loaded into 'R' and then run by choosing "Run All" under the "Edit" menu.
This R-script begins by defining two internal functions.  The first function when called will smooth the data over a window of size 'num'.  This smoothing is chosen by selecting the maximum value inside the window.  An alternate approach is to use the average over the window.  Although average returns a smaller value when this function is called, analysis of the reverberation time is not significantly affected by which smoothing function is chosen.  The second function defined by the script is a thresholding function.  This allows the script to automatically locate regions where the smoothed data from the audio file is increasing (when the sound is turned on), reaches a maximum (room reaches equilibrium between energy provided by the source and energy removed by absorption from surfaces in the room), drops from maximum (sound source turned off) and returns to the minimum (room achieves ambient state).
Once the two functions are defined the script will load in the file "Pulse1k.txt" and rectify the data (take the absolute value).  Next the smoothing function is called and the data is down sampled by 44.1 times.  Since the sound file is sampled at 44.1 kHz, this down sampling makes the time increment between adjacent data points equal to 1 millisecond.  Next this data is plotted and saved as the file "Envelope1k.pdf".  At this point the threshold function is used to find the regions of acoustic energy growth and decay.  The growth curve is plotted and saved as "GrowthCurve1k.pdf".  Using a model of exponential growth to a limit, the growth curve is transformed into a linear relationship between time and transformed data.  The slope of this line is the time constant of this curve.  Again this linear relationship is plotted and saved as "GrowthFit1k.pdf".  In like fashion the decay curve is saved as "DecayCurve1k.pdf" and the transformed data is saved as "DecayFit1k.pdf".  Noise in the collected data and the effect of standing waves in the room, can throw the threshold detection calculation off.  As a result, the last part of the R-script allows a specific segment of the data to be plotted and transformed.  These results are also saved as "DecayCurve1k.pdf" and "DecayFit1k.pdf" respectively.  The starting location of the decay curve will be around 5500 ms (5.5 s) and end around 8000 ms  (8.0 s).
The R-scripts for analyzing the pure tones was adjusted depending on the frequency being analyzed.  Since a 1kHz pure tone repeats every 1 millisecond, setting the smoothing window to 44.1 samples should effectively smooth out a constant amplitude tone.  Since the recorded data is rectified before smoothing, the rectified peaks occur every 22.05 samples.  Therefore, setting the smoothing window to 23 samples gives fairly smooth data once the room reaches equilibrium with respect to acoustic energy.  At 500 Hz the rectified data repeats every 44.1 samples, so a smoothing window of 45 data points is used.  Similar adjustments are made for the analysis of the 2 kHz and 4 kHz analysis.  The following are the R-scripts for those analyzes.

Links to relevant R-scripts for analyzing room response to pure tones

Because pure tones can establish standing waves in a room, the decay curve can have peaks and dips of intensity as the effects of constructive and destructive interference changes.  As a result, it is better to analysis a room using a range of frequencies.  This can be done using a warble around the mean frequency or using white noise, which is band-pass filtered about the mean frequency.  Since the peak of each oscillation is not predictable as with the pure tone, a larger smoothing window must be used.  In this case a 500 points smoothing window is used.  Although it is not proven here, it is possible to show that analysis of an exponentially decaying curve will give the same time constant independent of window size.  This is contingent on the window only including points that belong to the decay curve and not data where the room is at equilibrium with regard to acoustic energy.  As you make the window larger, you will reduce the fluctuations between adjacent smoothed data points where the room is at equilibrium.  Using sampling theory applied to random variables, the standard deviation of the data should decrease by 1/sqrt(2) when the window size is doubled.  In the racquetball example, a comparison is made between analyzes of varying window size.  The modified R-scripts for analyzing warble and white noise centered about different frequencies are the following.

Links to relevant R-scripts for analyzing room response to warble and white noise

Racquetball Court Example

Theoretical Calculation

The accuracy of this method was tested using the campus racquetball courts.  These rooms have very little absorption given their hard surfaces and give you a very large reverberation time.  The dimensions of a court is 12.2 m deep and 6.1 m wide and 6.1 m tall giving a volume of 454 m3.  There are six surfaces in the room.  The floor has an area of 74.4 m2 and is made of hardwood placed on concrete.  Let's say the absorption coefficient is similar to vinyl tile on concrete, which is 0.03.  The  front, side walls and ceiling are of similar material and have a collective area of 260.4 m2.  From the absorption coefficients table, Gypsum wallboard on studs is the closest to our room and this coefficient is 0.04.  (In reality the absorption is less because these walls are more rigid than wallboard and are able to withstand impacts of the ball and bodies without deforming.)  The back wall is a thick plate glass of area 37.2 m2 and has a coefficient of 0.03.  Performing the theoretical calculation with Sabine's formula, the racquetball court should have a reverberation time around 5.3 s.  This calculation used values for frequencies around 1 kHz.

Experimental Measurement

The reverberation time of the racquetball court was made by placing the speaker near the middle of the court with its back to the floor.  The microphone was placed on the floor using a 20 cm tall stand and placed about 4 m away from the speaker towards the glass back wall.  A sound meter on C weighting was place on the floor next to the microphone.  The rest of the equipment was placed outside the room.  Using ACMUS, the 5 second long 1 kHz tone was played and data collected.  The volume of the amplifier was increased and the sound resampled until the resulting data was near but not exceeding the maximum recording level of the laptop's sound card.  In this case the sound meter read a sound pressure level of 76 dB.

Analysis on 1 kHz Signal

Performing the analysis using the R-script, the following decay curve was observed and its associated transformed curve.
Decay Curve   Transformed Data

The variation in the decay curve is the result of standing waves being set up in the room.  This is clearly seen when you look at the plot of all the smoothed data and an extended clip of the decay curve showing the plateau before the decay begins as seen below. 
Smoothed Data     Extended Decay Curve
The linear fit to the transformed data gives an exponential decay constant of 620 milliseconds.  This value may be in error due to the significant peaks in the decay curve.  A better method is to use a warble centered on 1 kHz.  Using a smoothing window which is 500 data points wide we get a decay curve and transformed curve as follows.
Warble Decay Curve     Warble Transformed Data
Using white noise with a half octave filter centered on 1 kHz, the following decay curve and transformed curve are obtained.  Notice that the decay constants for the warble and white noise are close to each other, but noticeably different than the pure tone.
White noise Decay Curve   White Noise Transformed Data

Effect of Smoothing Window on Analysis

As mentioned previously, the size of the smoothing window affects the variability of the smoothed data, but does not have an impact on the exponential decay constant.  The following images show the smoothed data for the room response to filtered white noise centered about 1 kHZ.  The window sizes are 500 pts, 1000 pts and 2000 pts.  Since the sampling rate of the data is 44.1 kHz, these smoothing windows correspond to 11.3, 22.7 and 45.4 milliseconds respectively.  The numerical values on the horizontal axis have units of milliseconds.
1 kHz White Noise - 500 pts     1 kHz White Noise - 1000 pts     1 kHz White Noise - 2000 pts
The time constant in the decay region for each of these curves is 0.813, 0.829 and 0.827 s respectively.

Summary of Analysis

The racquetball response was measured for signals centered at 500, 1000, 2000 and 4000 Hz.  The types of signals used were pure tones, 1/2 octave warbles about the central frequency and 1/2 octave filtered white noise centered about the given frequency.  Two runs were made in each case and the reported value is the average and the uncertainty half the difference between the two measurements.  (If the room was being analyzed more carefully, five or more measurements would be made for each condition so meaningful statistics could be generated.)  The results are as follows:

500 Hz
1 kHz
2 kHz
4 kHz
Pure Tone
0.664 ± 0.013 s
0.587 ± 0.008 s 0.649 ± 0.009 s 0.306 ± 0.006 s
Warble
0.842 ± 0.008 s 0.847 ± 0.006 s 0.672 ± 0.005 s 0.393 ± 0.007 s
White Noise
0.827 ± 0.016 s 0.813 ± 0.004 s 0.653 ± 0.002 s 0.374 ± 0.006 s
Results from the pure tone analysis are noticeably different than the warble and white noise analysis at 500 Hz and 1 kHz.  At the higher frequencies the difference is not as large; however, this may be the fortuitous lack of significant standing waves in this particular set-up.  The warble and white noise analyzes are similar and give some confidence that they are representative of the room.  Probably the most noticeable trend is the reduction of the time constant for higher frequencies.  This should be expected since the absorption coefficients are usually larger for higher frequencies.  Using the results from the white noise analysis and converting the exponential decay constant into a reverberation time, the room response of the racquetball court is.

500 Hz
1 kHz
2 kHz
4 kHz
RT
5.71 s
5.61 s
4.51 s
2.58 s
At the beginning of the racquetball court example, a theoretical calculation was made for the reverberation time at 1 kHz.  This value is 5.3 s, which is very close to the analyzed value of 5.6 s.

Conclusion

As demonstrated in this exercise, the reverberation time of a room can be determined experimentally with relatively inexpensive equipment.  This is contingent on the availability of a laptop computer, stereo amplifier and a moderate quality speaker.  Although some of the following equipment may be available, it is more likely that they need to be purchased.  This equipment includes a dynamic microphone, pre-amp and assorted speaker cords and adapter plugs.  The procedure for measuring the reverberation time is convoluted due to the variety of software packages used.  In the future this can be simplified by expanding the capabilities of AudioEdit.  This includes generating sound files by running R-scripts, playing and saving audio files and performing final analysis on the data.  Since AudioEdit is written in Java and R this solution should be platform independent.
One final point needs to be made with respect to the amplifier and speaker size.   It was mentioned that a sound level of  76 dB was established in the racquetball court before the sound was cut off and the decay curve was measured.  The relationship between sound level and speaker power is given by the formula
Lp = Lw + 10 log(1/{2π r2} + 4/R)
where Lw is the sound power level in dB, r is the distance between the sound source and the microphone and R is the room constant.  The speaker power is related to sound power level by the formula Lw = 10 log(W/W0), where W0 = 10 -12 watts.  Therefore, power equals
W = W0 10(Lw/10)
The room constant is calculated with the formula
R = αavg St/(1 - αavg)
where St is the total area and αavg equals Σ(αi Si)/St.  Using the room dimensions and absorption coefficients from the theoretical calcuations, the total area is 372 m2 and the average absorption coefficient is 0.037.  Therefore the room constant is 14.3.  From the first equation in the conclusion we find that
Lw = Lp - 10 log(1/{2π r2} + 4/R)
The distance between the speaker and the microphone is 4 m.  Therefore, Lw = 81.4 dB and W = 0.138 milliwatts.  For reference, normal talking is 70 dB (0.01 milliwatts) and loud talking is 90 dB (1 milliwatt).  The problem at this point is relating this acoustic power to electrical power sent to the speaker.  Home speakers have an efficiency around 0.5% so to achieve 0.138 milliwatts of acoustic power you need to supply 27.6 watts of electrical energy.  This is consistent with the system used to measure the reverberation time of the racquetball court.



Author: Dr. Steven Gollmer, Dept. Science and Mathematics, Cedarville University
Email: gollmers@cedarville.edu
Date: Jan. 21, 2009