Fix gain compensation in STFT examples

This commit is contained in:
Robbert van der Helm
2022-04-28 17:24:35 +02:00
parent e35886c216
commit 58d7dc034c
2 changed files with 2 additions and 3 deletions

View File

@@ -124,7 +124,7 @@ impl Plugin for Stft {
) -> ProcessStatus {
// Compensate for the window function, the overlap, and the extra gain introduced by the
// IDFT operation
const GAIN_COMPENSATION: f32 = f32::consts::E / OVERLAP_TIMES as f32 / WINDOW_SIZE as f32;
const GAIN_COMPENSATION: f32 = 1.0 / (OVERLAP_TIMES as f32 / 2.0) / WINDOW_SIZE as f32;
self.stft
.process_overlap_add(buffer, OVERLAP_TIMES, |_channel_idx, real_fft_buffer| {