How do I design bandpass filter to measure SPL within a frequency range
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
This may be trivial and I've read through some answers on here but none seem basic enouigh for me to be able to go implement on my own. I have a wav file with an Fs of 32768 and I want to determine SPL re 1uPa for the band between ~125Hz and ~450Hz. Is there a simple way to go about doing this?
3 comentarios
Mathieu NOE
el 9 de Mayo de 2022
hello
I guess you want a RMS SPL (dB) single value and not a spectrum (fft)
in this case you have to compute the rms value of x_pass before you convert it to dB :
also do not forget to apply the scale factor so that if x_pass_rms represent a 1 micro Pascal (rms) signal you should get x_passdB = 0 dB
x_pass = bandpass(x,[100 200],fs);
x_pass_rms = sqrt(mean(x_pass.^2));
x_passdB = 20*log10(x_pass_rms/ref_1muPa)
Respuestas (1)
Sudarsanan A K
el 23 de En. de 2024
Hi Benjamin,
The approach described in the comments is on the right track for determining the Sound Pressure Level (SPL) in a specific frequency range from a digital audio signal.
Here's a step-by-step breakdown of how to implement this:
- Bandpass Filtering: Use the bandpass function to isolate the frequency range of interest. This will help to focus on the specific band where you want to measure the SPL.
- RMS Calculation: Compute the Root Mean Square (RMS) value of the filtered signal. The RMS value is a measure of the power of the signal and is necessary for SPL calculations.
- Reference Pressure: SPL is typically measured in decibels (dB) relative to a reference pressure, which for underwater acoustics is usually 1 microPascal (). You will need to have a reference value for 1 in the same scale as your signal.
- Conversion to Decibels: Convert the RMS value to dB using the formula 20 * log10(x_pass_rms / ref_1muPa). This will give you the SPL relative to the reference pressure.
Here is an outline of how you can implement these steps in MATLAB:
% Read the audio signal from the wav file
[x, fs] = audioread('signal.wav');
% Bandpass filter to isolate the frequency range of interest (here [100, 200])]
x_pass = bandpass(x, [100 200], fs, 'ImpulseResponse', 'iir');
% Calculate the RMS value of the bandpassed signal
x_pass_rms = sqrt(mean(x_pass.^2));
% Reference pressure (1 µPa for underwater acoustics)
ref_1muPa = 1e-6; % In Pascals
% Convert the RMS pressure to SPL in dB re 1 µPa
x_passdB = 20 * log10(x_pass_rms / ref_1muPa);
% Output the SPL value
disp(['The SPL within the frequency range is: ', num2str(x_passdB), ' dB re 1 µPa']);
Note that in real-world applications, the signal would need to be calibrated using a known sound pressure level to ensure the SPL readings are accurate. This typically involves recording a tone or noise at a known SPL and using that recording to determine the scaling factor for converting the digital signal's amplitude to actual pressure levels. Without this step, the SPL value calculated from an uncalibrated signal is not reliable for accurate measurements.
You can also perform SPL measurement in MATLAB using "splMeter" System object.
I hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Measurements and Spatial Audio en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!