|
template<typename T > |
constexpr T | bark2hertz (T z) noexcept |
| Converts a critical band rate in Bark scale to Hertz. More...
|
|
template<typename InputIt , typename OutputIt > |
constexpr void | complex2real (InputIt first, InputIt last, OutputIt d_first1, OutputIt d_first2) |
| Converts a range of complex numbers in two ranges storing the real and imaginary parts. More...
|
|
template<typename T > |
constexpr T | db2mag (T db) noexcept |
| Convert decibels to magnitude. More...
|
|
template<typename T > |
constexpr T | db2pow (T db) noexcept |
| Convert decibels to power. More...
|
|
template<typename T > |
constexpr T | deg2rad (T degree) noexcept |
| Convert angle from degrees to radians. More...
|
|
template<typename T > |
constexpr T | bark2band (T z) noexcept |
| Converts a frequency in Hertz into its equivalent Bark scale value. More...
|
|
template<mel_base scale, typename T > |
constexpr T | hertz2mel (T f) noexcept |
| Converts a frequency in Hertz into mels. More...
|
|
template<typename T > |
constexpr T | mag2db (T magnitude) noexcept |
| Convert magnitude to decibels (dB) More...
|
|
template<mel_base scale, typename T > |
constexpr T | mel2hertz (T mel) noexcept |
| Converts a frequency in mels to Hertz. More...
|
|
template<typename ForwardIt > |
constexpr meta::value_type_t< ForwardIt > | peak2peak (ForwardIt first, ForwardIt last) |
| Maximum-to-minimum difference in the range [first, last) More...
|
|
template<typename ForwardIt > |
constexpr meta::value_type_t< ForwardIt > | peak2rms (ForwardIt first, ForwardIt last) |
| Maximum Peak-magnitude-to-RMS ratio in the range [first, last) More...
|
|
template<typename T > |
constexpr T | pow2db (T power) noexcept |
| Convert power to decibels. More...
|
|
template<typename T > |
constexpr T | rad2deg (T radians) noexcept |
| Convert angle from radians to degrees. More...
|
|
template<typename T > |
constexpr std::complex< T > | real2complex (T real, T imag=static_cast< T >(0)) noexcept |
| Converts a real scalar to an equivalent complex number. More...
|
|
template<typename InputIt , typename OutputIt > |
constexpr void | real2complex (InputIt first, InputIt last, OutputIt d_first) |
| Converts a range of scalar numbers in to an equivalent complex number and stores the result in another range. More...
|
|
template<typename InputIt , typename OutputIt > |
constexpr void | real2complex (InputIt first1, InputIt last1, InputIt first2, OutputIt d_first) |
| Converts a range of scalar numbers in to an equivalent complex number and stores the result in another range. More...
|
|
template<typename T >
constexpr T edsp::converter::bark2band |
( |
T |
z | ) |
|
|
noexcept |
Converts a frequency in Hertz into its equivalent Bark scale value.
The conversion of a frequency f (Hz) into Bark is implemented as follows:
\[ { \alpha =[(26.81f)/(1960+f)]-0.53\, f] An then: - If \f$ \alpha < 2 \f$ then \f$ f_b = 0.15 * (2 - \alpha) \f$. - If \f$ \alpha > 20.1 \f$ then \f$ f_b = 0.22 * (\alpha - 20.1) \f$. @param f Frequency in Hz @returns Frequency in Bark scale. @see bark2band, hertz2band */ template <typename T> constexpr T hertz2bark(T f) noexcept { const auto b = (26.81 * f) / (1960 + f) - 0.53; if (b < 2) { b += 0.15 * (2 - b); } if (b > 20.1) { b += 0.22 * (b - 20.1); } return b; } /** @brief Converts a critical band rate in Bark into a critical bandwidth in Hz. The conversion of a critical band rate z into a critical bandwidth in Hz is implemented as follows: \f[ f = 52548/ (z^{2}-52.56z+690.39)\, with z in bark. \]
or
\[ {\displaystyle f=600\sinh(z/6)} {\displaystyle f=600\sinh(z/6)} \]
- Parameters
-
z | The critical band rate, in Bark |
- Returns
- The critical bandwidth in Hz.
template<typename T >
constexpr T edsp::converter::bark2hertz |
( |
T |
z | ) |
|
|
noexcept |
Converts a critical band rate in Bark scale to Hertz.
The conversion of a critical band rate z into Hertz is as follows:
\[ f = 52548/ (z^{2}-52.56z+690.39)\, with z in bark. \]
or
\[ {\displaystyle f=600\sinh(z/6)} {\displaystyle f=600\sinh(z/6)} \]
- Parameters
-
z | The critical band rate, in Bark |
- Returns
- Frequency in Hz.
- See also
- hertz2bark
template<mel_base scale, typename T >
constexpr T edsp::converter::hertz2mel |
( |
T |
f | ) |
|
|
noexcept |
Converts a frequency in Hertz into mels.
The popular formula from O'Shaugnessy's book can be expressed with different logarithmic bases:
\[ {\displaystyle m=2595\log _{10}\left(1+{\frac {f}{700}}\right)=1127\ln \left(1+{\frac {f}{700}}\right)} \]
- Parameters
-
- Returns
- Frequency in mels.
- See also
- mel2hertz, mel_base
template<mel_base scale, typename T >
constexpr T edsp::converter::mel2hertz |
( |
T |
mel | ) |
|
|
noexcept |
Converts a frequency in mels to Hertz.
Depending of the base, the corresponding inverse expressions are:
\[ {\displaystyle f=700\left(10^{\frac {m}{2595}}-1\right)=700\left(e^{\frac {m}{1127}}-1\right)} \]
- Parameters
-
- Returns
- Frequency in Hz.
- See also
- hertz2mel
template<typename ForwardIt >
constexpr meta::value_type_t<ForwardIt> edsp::converter::peak2rms |
( |
ForwardIt |
first, |
|
|
ForwardIt |
last |
|
) |
| |
Maximum Peak-magnitude-to-RMS ratio in the range [first, last)
Returns the ratio of the largest absolute value in the range [first, last) to the root-mean-square (RMS) value of the range. The Peak-magnitude-to-RMS Level is:
\[ y =\frac{\left| x \right|_{\infty}}{\sqrt{\frac{1}{N}\sum_{n=0}^{N-1}\left|x\left(i\right)\right|^2}} \]
- Parameters
-
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
- Returns
- Peak-magnitude-to-RMS ratio.