27 #ifndef EDSP_SPECTRAL_IRREGULARITY_HPP 28 #define EDSP_SPECTRAL_IRREGULARITY_HPP 31 namespace edsp {
namespace feature {
inline namespace spectral {
50 template <
typename ForwardIt>
52 using value_type =
typename std::iterator_traits<ForwardIt>::value_type;
53 value_type square_diff = 0, square_ampl = 0;
54 for (
auto until = (last - 1); first != until; ++first) {
55 const value_type diff = (*first + 1) - (*first);
56 square_diff += diff * diff;
57 square_ampl += (*first) * (*first);
59 return square_diff / square_ampl;
65 #endif //EDSP_SPECTRAL_IRREGULARITY_HPP constexpr auto spectral_irregularity(ForwardIt first, ForwardIt last)
Computes the spectral irregularity of the of the magnitude spectrum represented by the elements in th...
Definition: spectral_irregularity.hpp:51
Definition: amplifier.hpp:29