cosine static method

Float64List cosine(
  1. int size,
  2. double amplitude
)

Returns a cosine window, such as Hanning or Hamming.

w[i] = 1 - amp - amp * cos(2πi / (size - 1))

Implementation

static Float64List cosine(int size, double amplitude) {
  final offset = 1 - amplitude;
  final scale = 2 * math.pi / (size - 1);
  return _makeWindow(size, (i) => offset - amplitude * math.cos(scale * i));
}