# Parameters for room impulse response measurements using swept sine

24 views (last 30 days)
Jonas on 28 Jul 2021
Commented: Jimmy Lapierre on 3 Aug 2021
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

Jimmy Lapierre on 29 Jul 2021
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')
% 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.
Jimmy Lapierre on 3 Aug 2021
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.

### Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!