Parameters for room impulse response measurements using swept sine

hi all, I want to do get a rough idea of the acoustical impulse response of a room. This room is used by a choir and and I just want to get an idea how much the room influences timing and frequency accuracy.
To measure the room impulse response (RIR) and want to use a exponential swept sine. For that purpose I would like to know which frequency range should be used with regard to loudspeaker performance (e.g. freq. range of the loudspeaker), room size and singing frequency range. In addition I am interested in how short and long the sweep is allowed to be. If i want to do multiple swept sines in a row, how do i combine the IR in a way that does not add distortion in some way to the estimated IR. I have seen that there is an impulse response measurer, but i need to separate the audio recording from the IR extraction, because I do not have matlab available at that location.
I would do the following: use sweeptone to generate the sweep signal, then i play the sound in the mentioned room and record at the same time (and a bit longer of course) and then i would try to extract the IR using impzest. I tested that procedure in a small room with sweeps between 30Hz and 20kHz and durations of 2, 5, 10 and 20 seconds. the resulting RIRs from impzest had all different lengths and the length did not scale with the excitation signal (length was about .5, 1.6, 3.2 and 1.5s for sweep duration 2, 5, 10, 20s).
how could i combine RIRs from sines with different durations and/or multiple runs of a single sweep type. I also had a look into the RIR and the first noticable peak is at about 7.5ms, corresponding to 2.5m distance between loudspeaker and microphone. But the true distance is was about 1m. Can the bad loudspaker performance at 30Hz be the cause for that wrong value?
Many questions, i would be happy if someone could share some experience or answer a part of this question already. best regards

 Accepted Answer

Hi Jon,
Since you do not have access to MATLAB on site, you will want to use sweeptone to create the exponential swept sine that you will play on site, and impzest to compute the room impulse response when you come back with the recording.
For example, you could try a 3-second sweep. The silence part will dictate the length of the impulse response, and I assume your choir is in a very reverberant space, so you could try a 10-second silence. Specify the sample rate you want for your playback device. Then, the frequency range for the choir is probably above 100 Hz, and for the high end you want to be well above the highest note as to include harmonics. But since the sweep is exponential, the higher range does not consume much time, so I'd try 30Hz to FS/2 to be safe. Use repmat to make multiple copies of the sweep. The noise will be averaged by impzest if you provide multiple sweeps in a row like this.
FS = 48000; % your sampling rate
exc = sweeptone(3, 10, FS, 'SweepFrequencyRange', [30 FS/2]);
excrep = repmat(exc,5,1); % duplicate the sweep to reduce the noise floor
audiowrite("sweep30-3-10.wav",excrep,FS); % create file for playback on site
plot((1:length(excrep))/FS, excrep)
xlabel('Time (seconds)')
ylabel('Amplitude')
%[rec,fs] = audioread("recorded-sweep30-3-10.wav"); % load the recording
% For this example, let's simulate a response B instead
% Comment this line out once you have the recording above
fs = FS; B = [.9 .2 -.1 -.2 .1]; rec = filter(B,1,excrep); % simulation
% Compute the IR using the sweep (without the repeats) and the recording
% The recording should be trimmed so that it's the same length as excrep
ir = impzest(exc,rec);
plot((1:length(ir))/fs, ir)
xlabel('Time (seconds)')
xlim([0 .001]) % zoom on the beginning (increase this for actual recording)
title('Room impulse response (time)')
IR = fft(ir);
semilogx(linspace(0,fs/2,length(IR)/2+1), db(abs(IR(1:end/2+1))))
xlim([30 fs/2]), grid on
title('Room impulse response (frequency)')
xlabel('Frequency (Hz)')
ylabel('Amplitude (dB)')
This response will include the effect of the loudspeaker and microphone, but the room response will probably dominate the response, so you should be fine. You could try increasing the starting frequency to 60 or 80 Hz.

6 Comments

dear jimmy, thanks for your detailed input: you say the time behind the stimulus sets the duration of the measured RIR. but after the stimulus ended the answer of the room to low frequencies will be much weaker (because the stronger reponse will be during the further stimulus) than the answer to the more recent high frequencies, how does the approach conpensate for that issue. would it make sence to use upward and downward (meaning a time reversed upward sweep) sweeps regarding this issue and if yes, how can i combine the responses of both type of sweeps?
or does it make sence to make the chirp as short as necessary such that the earliest answer lies after the chirp has ended
and what about the duration of the sweep itself, if we choose a short sweep (as extreme nearly as short as a dirac), then the room's answer to all frequencies is denser when compared to a slow sweep. on the other side should a slow sweep allow a more detailed frequency response because each frequency lasts longer?
Hi Jonas,
You will not miss low frequencies. The final length of the IR you will obtain corresponds to the length of the silence, but the recording must include the sweep. Intuitively, you can see the sweep as a dirac that you "stretched out" with a filter, and to get the final impulse, you must reverse that "stretch" (that's one of the reasons why impzest asks for the original sweep). In the example above, you'd take the 13 seconds and "reverse" the 3-second stretch to obtain your 10-second IR. You are not throwing away the first 3 seconds of recording. If you prefer a mathematical explanation, we've included a few references in the documentation of impzest (and the code itself not obfuscated, you could have a look). You might also want to know that an exponential sweep has less high frequency energy relative to low frequencies compared to a dirac, but that is compensated for too.
The sweeptone function can produce sweeps from low to high or high to low frequency. If the system is perfectly linear, it will not matter, for the reasons above.
The duration of the sweep and the number of sweeps has to do with signal-to-noise ratio. If everything was perfect, a dirac would be fine. However, a practical dirac would have too little energy relative to noise in the room. By "stretching" out the dirac, we can safely output more energy; and by doing multiple runs, we can average out the noise. Be careful not to go to the extreme: repeating very loud and long sweeps with very little silent time could end up "cooking" the tweeters.
so in general it is better to use a longer sweep compared to short ones? which effect is stronger? doing e.g. 5 slow sweeps compared to 10 half as long sweeps?
For tips from someone with practical experience doing this, I'd try to find info from someone like Griesinger. I think he recommended several sweeps because of how a large room reacts to long sweeps, and we assume the room is a linear system, but it might not be as perfect as we assume.

thanks for your help. the site of David Griesinger can be found here instructions, explanations and files for audition and matlab used by Giesinger himself can be found under this link www.davidgriesinger.com/probes/sweep_folder.zip

His code pre-dates the availability of the impulse response features in the Audio Toolbox, but his experience certainly applies. He's one of the world's top experts in this field.
You can use the SweepFrequencyRange setting to do reversed and/or partial sweeps as he suggested (although I asked him about it, and it was not clear if he was still recommending doing that). Unless you are doing a large concert hall (his expertise), I would not bother trying splitting the sweep into segments unless I was running into problems, as there are trade-offs involved. In fact, I'd try first with a wide 20 to FS/2 sweep.

Sign in to comment.

More Answers (0)

Categories

Find more on Measurements and Spatial Audio in Help Center and File Exchange

Products

Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!