LASP 1.0
Library for Acoustic Signal Processing
|
Sound Level Meter implementation that gives a result for each channel. A channel is the result of a filtered signal. More...
#include <lasp_slm.h>
Public Member Functions | |
SLM (const d fs, const d Lref, const us downsampling_fac, const d tau, std::unique_ptr< Filter > pre_filter, std::vector< std::unique_ptr< Filter > > bandpass) | |
Initialize a Sound Level Meter. | |
~SLM () | |
void | reset () |
Reset state related to samples acquired. All filters reset to zero. Start again from no history. | |
SLM (const SLM &o)=delete | |
SLM & | operator= (const SLM &o)=delete |
SLM (SLM &&o)=default | |
dmat | run (const vd &input) |
Run the sound level meter on given input data. Return downsampled level data for each filterbank channel. | |
vd | Lpeak () const |
Calculates peak levels measured for each filter channel. The peak level is just the highest instantaneous measured power value. | |
vd | Leq () const |
Calculates equivalent (time-averaged) levels measured for each filter channel. | |
vd | Lmax () const |
Calculates max levels measured for each filter channel. The max value is the maximum time-filtered (Fast / Slow) power level. | |
Static Public Member Functions | |
static SLM | fromBiquads (const d fs, const d Lref, const us downsampling_fac, const d tau, const vd &pre_filter_coefs, const dmat &bandpass_coefs) |
Convenience function to create a Sound Level meter from Biquad filters only. | |
static SLM | fromBiquads (const d fs, const d Lref, const us downsampling_fac, const d tau, const dmat &bandpass_coefs) |
Convenience function to create a Sound Level meter from Biquad filters only. No pre-filter, only bandpass. | |
static us | suggestedDownSamplingFac (const d fs, const d tw) |
Comput a 'suggested' downsampling factor, i.e. a lower frame rate at which sound level meter values are returned from the computation. This is possible since the signal power is low-pas filtered with a single pole low pass filter. It can remove computational burden, especially for plotting, to have a value > 10. | |
Public Attributes | |
vd | Pm |
Public storage for the mean of the square of the signal. | |
vd | Pmax |
Public storage for the maximum signal power, after single pole low-pass filter. | |
vd | Ppeak |
Storage for maximum computed signal power so far. | |
us | N = 0 |
Sound Level Meter implementation that gives a result for each channel. A channel is the result of a filtered signal.
Definition at line 17 of file lasp_slm.h.
SLM::SLM | ( | const d | fs, |
const d | Lref, | ||
const us | downsampling_fac, | ||
const d | tau, | ||
std::unique_ptr< Filter > | pre_filter, | ||
std::vector< std::unique_ptr< Filter > > | bandpass | ||
) |
Initialize a Sound Level Meter.
Counter for the number of time samples counted that came in;
fs | Sampling frequency [Hz] |
Lref | Level reference, used to scale to proper decibel units (dB SPL / dBV, etc) |
downsampling_fac | Every 1/downsampling_fac value is returned from compute() |
tau | Time consant of level meter |
pre_filter | The pre-filter (Typically an A/C frequency weighting filter) |
bandpass | The parallel set of bandpass filters. |
Definition at line 15 of file lasp_slm.cpp.
SLM::~SLM | ( | ) |
Definition at line 50 of file lasp_slm.cpp.
|
delete |
|
default |
|
static |
Convenience function to create a Sound Level meter from Biquad filters only. No pre-filter, only bandpass.
fs | Sampling frequency [Hz] |
Lref | Level reference, used to scale to proper decibel units (dB SPL / dBV, etc) |
downsampling_fac | Every 1/downsampling_fac value is returned from compute() |
tau | Time consant of level meter |
bandpass_coefs | Biquad filter coefficients for bandpass filter. First axis isis the coefficient index, second axis is the filter index. |
Definition at line 92 of file lasp_slm.cpp.
|
static |
Convenience function to create a Sound Level meter from Biquad filters only.
fs | Sampling frequency [Hz] |
Lref | Level reference, used to scale to proper decibel units (dB SPL / dBV, etc) |
downsampling_fac | Every 1/downsampling_fac value is returned from compute() |
tau | Time consant of level meter |
pre_filter_coefs | Biquad filter coefficients for pre-filter |
bandpass_coefs | Biquad filter coeffiecients for bandpass filter |
Definition at line 83 of file lasp_slm.cpp.
|
inline |
Calculates equivalent (time-averaged) levels measured for each filter channel.
Definition at line 146 of file lasp_slm.h.
|
inline |
Calculates max levels measured for each filter channel. The max value is the maximum time-filtered (Fast / Slow) power level.
Definition at line 153 of file lasp_slm.h.
|
inline |
Calculates peak levels measured for each filter channel. The peak level is just the highest instantaneous measured power value.
Definition at line 139 of file lasp_slm.h.
void SLM::reset | ( | ) |
Reset state related to samples acquired. All filters reset to zero. Start again from no history.
Definition at line 193 of file lasp_slm.cpp.
Run the sound level meter on given input data. Return downsampled level data for each filterbank channel.
input | Raw input data |
Definition at line 148 of file lasp_slm.cpp.
|
static |
Comput a 'suggested' downsampling factor, i.e. a lower frame rate at which sound level meter values are returned from the computation. This is possible since the signal power is low-pas filtered with a single pole low pass filter. It can remove computational burden, especially for plotting, to have a value > 10.
fs | Sampling frequency of signal [Hz] |
tw | Time weighting of SLM low pass filter |
Definition at line 67 of file lasp_slm.cpp.
us SLM::N = 0 |
Definition at line 55 of file lasp_slm.h.
vd SLM::Pm |
Public storage for the mean of the square of the signal.
Storage for offset point in input arrays
Definition at line 43 of file lasp_slm.h.
vd SLM::Pmax |
Public storage for the maximum signal power, after single pole low-pass filter.
Definition at line 48 of file lasp_slm.h.
vd SLM::Ppeak |
Storage for maximum computed signal power so far.
Public storage for the peak signal power, before single pole low-pass filter.
Definition at line 53 of file lasp_slm.h.