lib_jsl_dsp/discrete/windows/blackmanharris.rs
1use super::general_cosine::general_cosine;
2
3/// The Blackman-Harris window is defined by a specific set of coefficients that provide a smooth tapering of the coefficients based on the position within the window. The coefficients are computed using the general cosine function with specific values to achieve the desired shape and spectral properties.
4pub fn blackmanharris(m: usize, sym: bool) -> Vec<f64> {
5 general_cosine(m, &[0.358_75, 0.488_29, 0.141_28, 0.011_68], sym)
6}
7
8#[cfg(test)]
9mod tests {
10 use super::*;
11 use crate::discrete::windows::test_support::assert_window;
12
13 #[test]
14 fn test_blackmanharris() {
15 assert_window(include_str!("../test_data/blackmanharris.csv"), blackmanharris(7, true));
16 }
17}