Remove post-IDFT windowing in STFT helper
There's no reason to.
This commit is contained in:
parent
175030b77c
commit
93ab08e5d5
|
@ -49,9 +49,8 @@ impl Default for Stft {
|
|||
let filter_window = util::window::hann(FILTER_WINDOW_SIZE);
|
||||
real_fft_scratch_buffer[0..FILTER_WINDOW_SIZE].copy_from_slice(&filter_window);
|
||||
|
||||
// And make sure to normalize this so the levels doesn't change much after convolving
|
||||
let filter_normalization_factor =
|
||||
real_fft_scratch_buffer.iter().sum::<f32>().recip() * 2.0f32.sqrt() * 2.0;
|
||||
// And make sure to normalize this so convolution sums to 1
|
||||
let filter_normalization_factor = real_fft_scratch_buffer.iter().sum::<f32>().recip();
|
||||
for sample in real_fft_scratch_buffer.as_slice_mut() {
|
||||
*sample *= filter_normalization_factor;
|
||||
}
|
||||
|
@ -129,7 +128,9 @@ impl Plugin for Stft {
|
|||
buffer: &mut Buffer,
|
||||
_context: &mut impl ProcessContext,
|
||||
) -> ProcessStatus {
|
||||
const GAIN_COMPENSATION: f32 = 1.0 / OVERLAP_TIMES as f32 / WINDOW_SIZE as f32;
|
||||
// Compensate for the window function, the overlap, and the extra gain introduced by the
|
||||
// IDFT operation
|
||||
const GAIN_COMPENSATION: f32 = 2.0 / OVERLAP_TIMES as f32 / WINDOW_SIZE as f32;
|
||||
|
||||
self.stft.process_overlap_add(
|
||||
buffer,
|
||||
|
|
|
@ -248,7 +248,6 @@ impl<const NUM_SIDECHAIN_INPUTS: usize> StftHelper<NUM_SIDECHAIN_INPUTS> {
|
|||
process_cb(channel_idx, None, &mut self.scratch_buffer);
|
||||
|
||||
// The actual overlap-add part of the equation
|
||||
multiply_with_window(&mut self.scratch_buffer, window_function);
|
||||
add_scratch_to_ring_buffer(
|
||||
&self.scratch_buffer,
|
||||
self.current_pos,
|
||||
|
|
Loading…
Reference in a new issue