eDSP  0.0.1
A cross-platform DSP library written in C++.
Functions
edsp::feature::perceptual Namespace Reference

Functions

template<typename ForwardIt >
constexpr auto loudness (ForwardIt first, ForwardIt last)
 Computes the loudness of the elements in the range [first, last) More...
 

Function Documentation

◆ loudness()

template<typename ForwardIt >
constexpr auto edsp::feature::perceptual::loudness ( ForwardIt  first,
ForwardIt  last 
)

Computes the loudness of the elements in the range [first, last)

The loudness is estimated with the Steven's Power Law. S.S. Stevens proposed a new law to relate sensation magnitude to stimulus intensity.

\[ S = k I^{\alpha} \]

where:

  • S is the sensation magnitude
  • k is an arbitrary constant
  • I is the stimulus intensity
  • \( \alpha \) is the power exponent.

To compute the loudness, we consider the energy of the signal as the stimulus intensity and \( \alpha = 0.67 \) (sound pressure of 3000-Hz tone).

Parameters
firstForward iterator defining the begin of the range to examine.
lastForward iterator defining the end of the range to examine.
Returns
The estimated loudness of the elements in the range.