eDSP
0.0.1
A cross-platform DSP library written in C++.
|
Functions | |
template<typename ForwardIt > | |
constexpr auto | spectral_crest (ForwardIt first, ForwardIt last) |
Computes the spectral crest of the of the magnitude spectrum represented by the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | spectral_decrease (ForwardIt first, ForwardIt last) |
Computes the spectral decrease of the of the magnitude spectrum represented by the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | spectral_entropy (ForwardIt first, ForwardIt last) |
Computes the spectral entropy of the of the power spectral density represented by the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | spectral_flatness (ForwardIt first, ForwardIt last) |
Computes the spectral flatness of the of the magnitude spectrum represented by the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | spectral_flux (ForwardIt first1, ForwardIt last1, ForwardIt first2) |
Computes the spectral flux of the of the magnitude spectrum represented by the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | spectral_irregularity (ForwardIt first, ForwardIt last) |
Computes the spectral irregularity of the of the magnitude spectrum represented by the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | spectral_kurtosis (ForwardIt first, ForwardIt last) |
Computes the spectral kurtosis of the of the magnitude spectrum represented by the elements in the range [first, last) More... | |
template<typename ForwardIt , typename Numeric > | |
constexpr auto | spectral_rolloff (ForwardIt first, ForwardIt last, Numeric percentage=0.95) |
Computes the spectral roll-off of the of the magnitude spectrum represented by the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | spectral_skewness (ForwardIt first, ForwardIt last) |
Computes the spectral skewness of the of the magnitude spectrum represented by the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | spectral_slope (ForwardIt first1, ForwardIt last1, ForwardIt first2) |
Computes the spectral slope of the of the magnitude spectrum represented by the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | spectral_spread (ForwardIt first1, ForwardIt last1, ForwardIt first2) |
Computes the spectral spread of the of the magnitude spectrum represented by the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | spectral_variation (ForwardIt first1, ForwardIt last1, ForwardIt first2) |
Computes the spectral variation of the of the magnitude spectrum represented by the elements in the range [first, last) More... | |
constexpr auto edsp::feature::spectral::spectral_crest | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the spectral crest of the of the magnitude spectrum represented by the elements in the range [first, last)
The spectral crest is a measure of the noisiness of the spectrum.
first | Forward iterator defining the begin of the magnitude spectrum. |
last | Forward iterator defining the end of the magnitude spectrum. |
constexpr auto edsp::feature::spectral::spectral_decrease | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the spectral decrease of the of the magnitude spectrum represented by the elements in the range [first, last)
The spectral decrease represents the amount of decreasing of the spectral amplitude. It is defined as:
\[ d = \frac{1}{ \sum_{n=2}^{N-1} x(n)} \sum_{n=2}^{N-1} \frac{x(n) - x(n-1)}{n - 1} \]
first | Forward iterator defining the begin of the magnitude spectrum. |
last | Forward iterator defining the end of the magnitude spectrum. |
constexpr auto edsp::feature::spectral::spectral_entropy | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the spectral entropy of the of the power spectral density represented by the elements in the range [first, last)
Spectral Entropy describes the complexity of a system. The PSD of a audio signal can be computed as the normalized version of the Power Spectral Density:
\[ p_i=\frac{P(\omega_i)}{\sum_iP(\omega_i)} \]
The Power Spectral entropy can be now calculated using a standard formula for an entropy calculation.
first | Forward iterator defining the begin of the magnitude spectrum. |
last | Forward iterator defining the end of the magnitude spectrum. |
first2 | Forward iterator defining the begin of the center frequencies range. |
constexpr auto edsp::feature::spectral::spectral_flatness | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the spectral flatness of the of the magnitude spectrum represented by the elements in the range [first, last)
The spectral flatness is a measure of the noisiness of the spectrum.
first | Forward iterator defining the begin of the magnitude spectrum. |
last | Forward iterator defining the end of the magnitude spectrum. |
constexpr auto edsp::feature::spectral::spectral_flux | ( | ForwardIt | first1, |
ForwardIt | last1, | ||
ForwardIt | first2 | ||
) |
Computes the spectral flux of the of the magnitude spectrum represented by the elements in the range [first, last)
first1 | Forward iterator defining the begin of the first magnitude spectrum. |
last1 | Forward iterator defining the end of the first magnitude spectrum. |
first2 | Input iterator defining the beginning of the second magnitude spectrum. |
constexpr auto edsp::feature::spectral::spectral_irregularity | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the spectral irregularity of the of the magnitude spectrum represented by the elements in the range [first, last)
The spectral irregularity quantifies the variations of the logarithmically-scaled rate-map across frequencies. This implementation is based on [Jensen 1999] where the spectral irregularity is estimated as the sum of the square of the difference in amplitude between adjoining partials.
first | Forward iterator defining the begin of the magnitude spectrum. |
last | Forward iterator defining the end of the magnitude spectrum. |
constexpr auto edsp::feature::spectral::spectral_kurtosis | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the spectral kurtosis of the of the magnitude spectrum represented by the elements in the range [first, last)
first | Forward iterator defining the begin of the magnitude spectrum. |
last | Forward iterator defining the end of the magnitude spectrum. |
constexpr auto edsp::feature::spectral::spectral_rolloff | ( | ForwardIt | first, |
ForwardIt | last, | ||
Numeric | percentage = 0.95 |
||
) |
Computes the spectral roll-off of the of the magnitude spectrum represented by the elements in the range [first, last)
The spectral roll-off point is the frequency so that \( \alpha \) of the signal energy is contained below this frequency.
first | Forward iterator defining the begin of the magnitude spectrum. |
last | Forward iterator defining the end of the magnitude spectrum. |
percentage | Number between [0, 1] representing the percentage of the total energy of the roll-off frequency. |
constexpr auto edsp::feature::spectral::spectral_skewness | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the spectral skewness of the of the magnitude spectrum represented by the elements in the range [first, last)
first | Forward iterator defining the begin of the magnitude spectrum. |
last | Forward iterator defining the end of the magnitude spectrum. |
constexpr auto edsp::feature::spectral::spectral_slope | ( | ForwardIt | first1, |
ForwardIt | last1, | ||
ForwardIt | first2 | ||
) |
Computes the spectral slope of the of the magnitude spectrum represented by the elements in the range [first, last)
The spectral slope represents the amount of decreasing of the spectral amplitude. It is computed by linear regression of the spectral amplitude:
\[ G = a f + b \]
where a is the parameter of interest. In this case is computed as follows:
\[ a = \frac{1}{\sum_k a(k)} \frac{N \sum_k a(k) f(k) - \sum_k a(k) * \sum_k f(k)} {N \sum_k f^2(k) - \left( \sum_k f(k) \right)^2} \]
where f is a vector representing the different frequency bins.
first1 | Forward iterator defining the begin of the magnitude spectrum. |
last1 | Forward iterator defining the end of the magnitude spectrum. |
first2 | Forward iterator defining the begin of the center frequencies range. |
constexpr auto edsp::feature::spectral::spectral_spread | ( | ForwardIt | first1, |
ForwardIt | last1, | ||
ForwardIt | first2 | ||
) |
Computes the spectral spread of the of the magnitude spectrum represented by the elements in the range [first, last)
The spectral spread describes the average deviation of the rate-map around its centroid, which is commonly associated with the bandwidth of the signal
\[ ss = \frac{\sum_{n = 0}^{N-1}((f(n) - sc)^2 X(n)}{\sum_{n = 0}^{N-1}X(n)} \]
where sc is the spectral centroid.
first1 | Forward iterator defining the begin of the magnitude spectrum. |
last2 | Forward iterator defining the end of the magnitude spectrum. |
first2 | Forward iterator defining the begin of the center frequencies range. The estimated spectral spread |
constexpr auto edsp::feature::spectral::spectral_variation | ( | ForwardIt | first1, |
ForwardIt | last1, | ||
ForwardIt | first2 | ||
) |
Computes the spectral variation of the of the magnitude spectrum represented by the elements in the range [first, last)
The spectral variation is a representation of the similarity between two magnitude spectrums. It is a parameter similar to the spectral flux.
\[ v = 1 - \frac{\sum_k X_1(k) X_2(K) }{ \sqrt{ \sum_k X_1(k)} \sqrt{\sum_k X_2(k)}} \]
If the variation is close to 0, the spectrum are really similar. Otherwise, if it is close to 1, the are highly dissimilar.
first1 | Forward iterator defining the begin of the first magnitude spectrum. |
last1 | Forward iterator defining the end of the first magnitude spectrum. |
first2 | Input iterator defining the beginning of the second magnitude spectrum. |