pub type SpectrumScalingFunction<'a> = &'a dyn Fn(f32, &SpectrumDataStats) -> f32;
Expand description

Describes the type for a function that scales/normalizes the data inside crate::FrequencySpectrum. The scaling only affects the value/amplitude of the frequency, but not the frequency itself. It gets 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. and 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.

This uses f32 in favor of crate::FrequencyValue because the latter led to some implementation problems.