EE2.LabB: Measurement and processing of room impulse responses
Teams: 
24 members per group 
Software: 
Audacity, Matlab 
Timetable: 
One week allocated. 
Aims of the Experiment

The aim of this experiment is to learn how to make MLSbased impulse response measurements and how to use them for analysis and postprocessing.
Equipment

Two omnidirectional microphones (AKG 414), one loudspeaker, one multichannel soundcard, sound pressure level meter, ear protecting/sound insulating headphones, tape meter, balloons.

Sound files (on campus only):
MLSdual.wav,
Cello_Anechoic.wav
1. Background
1.1 Maximum length sequence (MLS)
A maximum length sequence (MLS) is a pseudorandom binary signal made up of autogenerative 1 s and −1 s commonly used in acoustic measurements. This signal contains equal amounts of energy for all frequencies.
Due to its randomness in the time domain, autocorrelation of MLS results in the Dirac delta function.
Consider a linear system with input x(t), transfer function h(t) and output y(t).
For this system the crosscorrelation between the input and the output, R_{xy}(t) equals the autocorrelation of the input signal, R_{xx}(t) convolved with the transfer function h(t):
R_{xy}(t) = R_{xx}(t) * h(t).
If the input signal is an MLS, then,
R_{xx}(t) = δ(t)
R_{xy}(t) = δ(t) * h(t) = h(t).
Therefore, the transfer function, i.e., the impulse response of a room can be calculated by computing the crosscorrelation between the original MLS and its recording in the room.
1.2 Reverberation time and decay curve
The reverberation time is the time in seconds that the sound pressure level decreases by 60 dB, at a rate of decay given by the linear leastsquares regression of the measured decay curve from a level 5 dB below the initial level to 35 dB below.
The decay curve, E(t), is calculated as
E(t) = 10 log_{10} ∫_{t}^{∞}
h^{2}(τ) dτ,
where h(t) is the impulse response.
1.3 Twomicrophone source direction estimation
Twomicrophone source direction estimation is done easily by assuming that the sound source is at the far field so that the paths that the sound wave takes from the source to the microphones are parallel to each other.
Then using the geometry in Figure 1, the source direction can be found as
θ = cos^{−1} ( (d_{1} − d_{2} ) / a ).
Figure 1: Source direction estimation

As this method is based on the estimation of time delay of arrival, care should be taken to avoid aliasing.
In order to avoid aliasing, the phase difference between a pair of microphones should be less than π.
Then we require that
2πf_{max}τ ≤ π,
where τ is the time delay and f_{max} is the maximum frequency of operation.
The time delay τ is maximum when the sound source is in line with the microphone pair and so τ = d/c, where d is the microphone spacing and c is the speed of sound.
Therefore, d ≤ λ_{min}/2
(or f_{max} ≤ c/2d),
which puts a limit on the maximum frequency of sounds that could be localized by time delay information only.
2. Preliminary Work
 List different reverberation time measurement techniques.
 Calculate the total volume and total reflecting surface area of the recording environment whose floor plan is shown in Figure 2.
 Estimate the reverberation time of the room using the NorrisEyring reverberation equation below:
T = (−0.161V) / (S ln(1−α)),
where V is the volume, S is the surface area, and α is the mean absorption coefficient.
Use α = 0.2 for the mean absorption coefficient for the time being.
 Using this reverberation time, determine the minimum distance between the loudspeaker and the microphones:
d_{min} = 2 √((V) / (cT)),
where V is the volume of the environment, T is the estimated reverberation time and c is the speed of sound, which is approximately 344 m/s.
 Autocorrelate the original MLS sequence which was provided and plot the result in Matlab.
(You will use xcorr and plot functions in Matlab.)
Determine the useful portion of the resulting function that gives a single impulse.
 Calculate the aliasing frequency for human sound source localisation using the distance between your ears and comment on its relation to interaural time difference (ITD) and interaural intensity difference (IID) cues.
Figure 2: Studio floor plan

3. Experimental Work
3.1 Setup and sound level adjustments
 Place the loudspeaker somewhere in the room at least 1 m away from major reflecting surfaces wherever possible.
Position the microphones 12 cm apart while their midpoint is more than d_{min} distance away from the loudspeaker as shown in Figure 3(a).
The loudspeaker should face the midpoint of the microphones. Position the heights of the microphones and the loudspeaker, so that they are at least 1 m.
Figure 3: Recording positions of the microphones (circles) and the loudspeaker (square).

 On the floor plan of the room mark the loudspeaker and microphone positions indicating their distances from the walls.
 Measure and record the Aweighted background noise level.
 When the MLS signal is being played through the loudspeaker measure the peak sound pressure level at the microphone positions and adjust the sound level so that it is at least 45 dB above the background noise level.
Protect your ears during this process!
Record the adjusted peak sound pressure levels.
 Make sure that the directivity pattern of the AKG microphones are set to omnidirectional (indicated with a circle) using the switches on the microphones.
3.2 Recordings
3.2.1 Recording with MLS
 Make sure that the gains of the microphone pair are the same.
You can adjust the gains using the switches on the microphones.
The cutoff settings of the microphones should be at 0 Hz.
 The MLS signal has been repeated twice in the provided wave file to avoid the transient response of the loudspeaker affecting the recordings.
Make a trial recording to observe this transient response.
Adjust the gain of the microphones, so that there is no overloading, i.e., clipping of the recorded sound.
 You are required to make three MLS recordings with three different positioning of the microphones as shown in Figure 2.
The playing of the MLS signals and recording should be made synchronously.
Make sure that the recording is stopped only after the reverberation completely dies out, not with the end of the MLS signal.
3.2.2 Recording with an Impulsive Source
 Instead of the loudspeaker you will use balloons to create impulsive sounds.
Inflate a balloon and puncture it with a sharp object, while recording the burst sound.
In this way make impulse response recordings for the three recording positions.
3.3 Analysis and Synthesis
The rest of the tasks will be carried out in Matlab.
Therefore, transfer your files to your home directories and then to the Matlab workspace.
You may use wavread function of Matlab to do this.
3.3.1 Room Impulse Responses
 Calculate room impulse responses from the MLS recordings by crosscorrelating the recordings with the original MLS sequences and removing the unnecessary portions.
Save the resulting impulse responses as 16 bit, 44.1 kHz wave files. (You will use wavwrite function for saving.)
 Estimate the source direction by calculating the time delay between the impulse responses captured by the pair of the microphones using crosscorrelation.
 Convolve an anechoic sound with one of the calculated room impulse responses and save the result as a 16 bit 44.1 kHz wave file.
3.3.2 Energy Decay Curves
 Calculate and plot the logarithm of the energy decay curve, E(t) for one of the calculated impulse responses.
You will need to implement a simple for loop and use the sum function to calculate the integral in Matlab.
 Calculate and plot the logarithm of the energy decay curve for the impulse response recorded by bursting a balloon for the same setup and microphone.
 Compare the two energy decay curves and comment on the factors that would lead to any differences.
3.3.3 Reverberation Time Calculation
 Estimate the reverberation time from the decay curve of one of the calculated impulse responses.
For this purpose refer to the definition of the reverberation time. You will need to fit a line to the measured decay curve from a level 5 dB below the initial level to 35 dB below.
Select only this portion of the decay curve which will provide the Y data.
Also define the corresponding X data in seconds.
Plot the Y data with respect to X data.
In the Matlab figure window, open Basic Fitting in the Tools menu.
Apply linear fitting with the "show equation" check box selected.
Save this figure.
Use the coefficients of the resulting line, p1 and p2 to solve the following equation for the reverberation time T:
−60 dB = p1 T + p2.
 Using the NorrisEyring reverberation equation below, estimate the average surface absorption, α:
RT_{60} = (−0.161V) / (S ln(1−α)),
where V is the volume and S is the surface area.
Use the reverberation time calculated in the previous step.