MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ blackman()

MAYAFLUX_API std::vector< double > MayaFlux::Kinesis::Discrete::blackman ( size_t  n)

Blackman taper coefficients.

Parameters
nLength in samples
Returns
Coefficient vector of length n

Definition at line 37 of file Taper.cpp.

38{
39 if (n == 0)
40 return {};
41 if (n == 1)
42 return { 1.0 };
43 std::vector<double> w(n);
44 const double scale = std::numbers::pi * 2.0 / static_cast<double>(n - 1);
45 for (size_t i = 0; i < n; ++i) {
46 const double x = scale * static_cast<double>(i);
47 w[i] = 0.42 - 0.5 * std::cos(x) + 0.08 * std::cos(2.0 * x);
48 }
49 return w;
50}
float scale

References scale.