Simple room microphone sound pressure level measurement simulation program

I have always wanted to write an article about measuring sound pressure level with a microphone, but I have not spared time. Just a while ago, there was a project that used this knowledge. When the project is over, I will summarize the relevant knowledge.

The general idea is to emit sound from a point source in a room, then measure the sound pressure at any position in the room, and give a simulation program. The RIR (Room Impulse Response), the simulated sound transmission path, and the calculation of the sound pressure level must be used here.

1. Room impulse response and T60

The room shock response function still uses the old German method, the mirror method

https://www.audiolabs-erlangen.de/fau/professor/habets/software/rir-generator

c = 340;                    % Sound velocity (m/s)
fs = 16000;                 % Sample frequency (samples/s)
r = MicPos;              % Receiver position [x y z] (m)
s = SpeakerPos;              % Source position [x y z] (m)
Rdim = [L W H];                % Room dimensions [x y z] (m)


% sound absorption coefficient
alpha = 0.3;

rc = 1 - alpha;
beta = rc *ones(1,6);

h = rir_generator(c, fs, r, s, Rdim, beta, n);

Among them, beta is two input methods. A single data is the reverberation time . If it is a vector with 1 row and 6 columns, you can set the reflection

clean_signal = audioread('test.wav');

reverb_signal = fftfilt(h,clean_signal);
audiowrite('test_reverb.wav',reverb,fs);

A section of sound is attenuated by the acoustic transmission path and reverberation is added, the effect is as follows:

Note that this is only a point source result, and there is no additional noise

The T60 time is simple and can be calculated directly with the help of tools

%Calculation volume
V = L*W*H;

% Calculated surface area
S = 2*(L*W + W*H + H*L);

T60 = 0.161*V/(alpha*S);

2. Matlab drawing simulates the sound transmission path

With the help of shape in Matlab, it is very convenient to draw the simulation position of the room, electric sound source and mic

This is the direct sound, and the reflected sound is more troublesome, especially the multiple reflections. I only deal with single reflections here for convenience.

First find the speaker sound source point to mirror a certain wall

MirrorPos = [2*L - SpeakerPos(1),SpeakerPos(2),SpeakerPos(3)];

The green dot in the figure below is the symmetry point of the speaker with respect to the wall on the right

With the help of the following program, find the point of intersection of a straight line and a plane in space

Intersection points are marked in yellow

https://www.mathworks.com/matlabcentral/fileexchange/17751-straight-line-and-plane-intersection

Connect lines, draw arrows, hide virtual mirror points

This draws 6 (single) reflection cases:

The reflection paths and attenuation conditions may be different, together with the direct sound, the combination creates the effect of the reverberation field

3. Calculation of sound pressure level

Assuming that the sound pressure of the speaker electric sound source is 80dBSPL, find the sound pressure at the microphone, which we can directly calculate based on the rms value of the signal

First, according to the relevant standards, it is necessary to generate an A-weighting filter, which is generated by the following program

https://www.mathworks.com/matlabcentral/fileexchange/64231-calibratevoicespl?s_tid=srchtitle

%产生 A-weighting filter
[b,a] = adsgn(fs);
[h,w] = freqz(b,a,1024);
semilogx(w/pi,20*log10(abs(h)));

Compare with the real curve:

http://www.larsondavis.com/support/sound-measurement-terminology

The sound pressure at the mic position can be calculated by simple summation

4. Some extended instructions

The calculation method of the real sound pressure should be in the standard iec_61672, which specifically describes the sound pressure Sound level meters - Part 1: Specifications

According to some materials referenced by Matlab, https://www.mathworks.com/help/audio/ref/splmeter-system-object.html

And py related information in github https://github.com/python-acoustics/python-acoustics/blob/master/acoustics/standards/iec_61672_1_2013.py

There are roughly the following sound pressure levels:

frequency-weighted sound levels  Lf ?
fast or slow time-weighted sound levels  Lt
equivalent-continuous sound levels(等效连续声压级) Leq
peak sound levels Lp
maximum sound levels  Lmax

Focus on two things:

a. Equivalent continuous sound pressure level, the feeling is integral and average

b. The time-weighted sound levels sensory curve will change in real time, is it used by sound pressure level equipment? [to be verified], divided into fast and slow

 

Defined as the convolution of y (after weights) and the impulse response, involving exponential function integration

There are three types of sound level meters that are actually used:

http://www.intecconinc.com/index.php/productos?format=raw&task=download&fid=24

35ms 125ms, and 1s corresponds to the following τ (tao)

 

 Constants given by py:

Exponential function above

Negative infinity, t generally starts from 0, so the negative semi-axis does not need to be considered, the exp function is the smallest when tx = 0, and close to 1 when tx = t, then it is a weighting of time

The further away from time, the lower the weight, the closer the higher

Similar to the forgetting curve, https://zhuanlan.zhihu.com/p/274352214

 https://zhuanlan.zhihu.com/p/274352214

 

This is also in line with common sense. The sound heard some time ago, after all, left an impression in the listener's mind and memory, and the shorter the time, the deeper the impression .

 

Guess you like

Origin blog.csdn.net/book_bbyuan/article/details/115763197