eDSP
0.0.1
A cross-platform DSP library written in C++.
|
Classes | |
class | leq |
This class estimates the Equivalent Continuous Sound Level over consecutive frames. More... | |
Functions | |
template<typename InputIt , typename OutputIt > | |
constexpr void | amdf (InputIt first, InputIt last, OutputIt d_first) |
Computes the AMDF (Average Magnitude Difference Function) of the contiguous elements in the range [first, last) and stores the result in another range, beginning at d_first. More... | |
template<typename ForwardIt , typename Numeric > | |
constexpr auto | duration (ForwardIt first, ForwardIt last, Numeric samplerate) |
Computes the duration of the elements in the range [first, last) More... | |
template<typename ForwardIt , typename Numeric > | |
constexpr auto | effective_duration (ForwardIt first, ForwardIt last, Numeric samplerate, Numeric threshold) |
Computes the effective duration of the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | energy (ForwardIt first, ForwardIt last) |
Computes the energy of the elements in the range [first, last) More... | |
template<typename ForwardIt , typename Numeric > | |
constexpr auto | lat (ForwardIt first, ForwardIt last, Numeric samplerate, Numeric start_threshold, Numeric stop_threshold) |
The laq class estimates the logarithmic attack time of an envelope signal. More... | |
template<typename ForwardIt > | |
constexpr auto | power (ForwardIt first, ForwardIt last) |
Computes the instant power of the elements in the range [first, last) More... | |
constexpr void edsp::feature::temporal::amdf | ( | InputIt | first, |
InputIt | last, | ||
OutputIt | d_first | ||
) |
Computes the AMDF (Average Magnitude Difference Function) of the contiguous elements in the range [first, last) and stores the result in another range, beginning at d_first.
Computes the AZCR (Average Zero Crossing Rate) of the contiguous elements in the range [first, last) and stores the result in another range, beginning at d_first.
Computes the ASDF (Average Square Difference Function) of the contiguous elements in the range [first, last) and stores the result in another range, beginning at d_first.
The definition of AMDF is:
\[ Q_x[k,n_0] \triangleq \frac{1}{N} \sum\limits_{n=0}^{N-1} \Big| x[n+n_0] - x[n+n_0+k] \Big| \]
first | Input iterator defining the begin of the range to examine. |
last | Input iterator defining the end of the range to examine. |
d_first | Output iterator defining the begin of the output range. |
The definition of ASDF is:
\[ Q_x[k,n_0] \triangleq \frac{1}{N} \sum\limits_{n=0}^{N-1} \big( x[n+n_0] - x[n+n_0+k] \big)^2 \]
There is a relation between the ASDF function and the ACF function:
\[ \begin{align} x[k] & \triangleq \frac{1}{N} \sum x[n] x[n+k] \\ & = \overline{x^2[n]} - \tfrac{1}{2} Q_x[k] \\ & = R_x[0] - \tfrac{1}{2} Q_x[k] \\ \end{align} \]
first | Input iterator defining the begin of the range to examine. |
last | Input iterator defining the end of the range to examine. |
d_first | Output iterator defining the begin of the output range. |
The definition of AZCR is:
\[ {\displaystyle zcr={\frac {1}{T-1}}\sum _{t=1}^{T-1}\mathbb {1} _{\mathbb {R} _{<0}}(s_{t}s_{t-1})} \]
first | Input iterator defining the begin of the range to examine. |
last | Input iterator defining the end of the range to examine. |
d_first | Output iterator defining the begin of the output range. |
constexpr auto edsp::feature::temporal::duration | ( | ForwardIt | first, |
ForwardIt | last, | ||
Numeric | samplerate | ||
) |
Computes the duration of the elements in the range [first, last)
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
samplerate | Sampling frequency in Hz. |
constexpr auto edsp::feature::temporal::effective_duration | ( | ForwardIt | first, |
ForwardIt | last, | ||
Numeric | samplerate, | ||
Numeric | threshold | ||
) |
Computes the effective duration of the elements in the range [first, last)
The effective duration is a measure of the time the signal is perceptually meaningful. It is approximated by the time the energy envelope is above a given threshold.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
samplerate | Sampling frequency in Hz. |
threshold | Numeric value in the range [0, 1] representing the active threshold. |
constexpr auto edsp::feature::temporal::energy | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the energy of the elements in the range [first, last)
The energy estimates the signal power at a given time, it is estimated directly from the signal frame around a given time:
\[ e = \sum\limits_{n=0}^{N-1} x^2(n) \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr auto edsp::feature::temporal::lat | ( | ForwardIt | first, |
ForwardIt | last, | ||
Numeric | samplerate, | ||
Numeric | start_threshold, | ||
Numeric | stop_threshold | ||
) |
The laq class estimates the logarithmic attack time of an envelope signal.
The log-attack time is the logarithmic (decimal base) of the time duration between the time the signal to the time it reaches its stable part:
\[ lat = \log10 \left( t_{stop} - t_{start} \right) \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
samplerate | Sampling frequency in Hz. |
start_threshold | Numeric value between [0, 1] representing the percentage of the amplitude signal representing the start of the attack time. |
stop_threshold | Numeric value between [0, 1] representing the percentage of the amplitude signal representing the limit of the attack time. |
constexpr auto edsp::feature::temporal::power | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the instant power of the elements in the range [first, last)
The energy of signal can be computed as:
\[ P_x = \frac{1}{N} \sum\limits_{n=0}^{N-1} x^2(n) \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |