MCPcopy Create free account
hub / github.com/evilsocket/cake / hann_window

Function hann_window

cake-core/src/models/luxtts/mel.rs:95–102  ·  view source on GitHub ↗

Generate a Hann window of the given size.

(size: usize)

Source from the content-addressed store, hash-verified

93
94/// Generate a Hann window of the given size.
95fn hann_window(size: usize) -> Vec<f32> {
96 (0..size)
97 .map(|i| {
98 let phase = 2.0 * std::f32::consts::PI * i as f32 / size as f32;
99 0.5 * (1.0 - phase.cos())
100 })
101 .collect()
102}
103
104/// Build mel filterbank matrix [n_mels, n_freq].
105fn mel_filterbank(n_mels: usize, n_freq: usize, sample_rate: usize, n_fft: usize) -> Vec<f32> {

Callers 2

compute_stftFunction · 0.85
test_hann_windowFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_hann_windowFunction · 0.68