1
0
Fork 0

Fix position increment in STFT helper

This was what was causing the spectral leakage. It already sounded like
parts of the buffer were being cleared too early or old parts were being
reused, but I guess that makes sense now...
This commit is contained in:
Robbert van der Helm 2022-03-06 18:45:34 +01:00
parent 82e74a7c53
commit 7c8da39159

View file

@ -205,6 +205,9 @@ impl<const NUM_SIDECHAIN_INPUTS: usize> StftHelper<NUM_SIDECHAIN_INPUTS> {
} }
} }
already_processed_samples += samples_to_process;
self.current_pos = (self.current_pos + samples_to_process) % block_size;
// At this point we either have `already_processed_samples == main_buffer_len`, or // At this point we either have `already_processed_samples == main_buffer_len`, or
// `self.current_pos % window_interval == 0`. If it's the latter, then we can process a // `self.current_pos % window_interval == 0`. If it's the latter, then we can process a
// new block. // new block.
@ -253,10 +256,6 @@ impl<const NUM_SIDECHAIN_INPUTS: usize> StftHelper<NUM_SIDECHAIN_INPUTS> {
); );
} }
} }
// Do this after handling the block or else we'll copy the wrong samples.
already_processed_samples += samples_to_process;
self.current_pos = (self.current_pos + samples_to_process) % block_size;
} }
} }
} }