1% win = mfcc_blackman(length, a0)
2%
3% Input
4%   length - length of window
5%   a0 - optional, parameter a0 for equation
6%
7% Output
8%   window coefficients
9%
10% https://en.wikipedia.org/wiki/Window_function#Blackman_window
11
12% SPDX-License-Identifier: BSD-3-Clause
13%
14% Copyright (c) 2022, Intel Corporation. All rights reserved.
15
16function w = mfcc_blackman(win_length, a0)
17
18	if nargin < 2
19		a0 = 0.42; % Default in Kaldi compute-mfcc-feats
20	end
21
22	alpha = 1 - 2 * a0;
23	a1 = 1/2;
24	a2 = alpha / 2;
25
26	n = (0:(win_length - 1))';
27	a = 2 * pi / (win_length -1);
28	w = a0 - a1 * cos(a * n ) + a2 * cos(2 * a * n / win_length);
29
30end
31