pub type SpectrumScalingFunction = dyn Fn(f32, &SpectrumDataStats) -> f32;Expand description
Describes the type for a function that scales/normalizes the data inside
FrequencySpectrum.
The scaling only affects the value of the frequency, but not the frequency itself. It is applied to every single element.
A scaling function can be used for example to subtract the minimum (min)
from each value. It is optional to use the second parameter
SpectrumDataStats, which describes the spectrum before the function is
applied to it.
The type works with static functions as well as dynamically created closures.
You must take care of, that you don’t have division by zero in your function
or that the result is NaN or Infinity (regarding IEEE-754). If the result
is NaN or Infinity, the library will return Err.