Commit f5176b9
audio: phase_vocoder: re-anchor synthesis phase on speed change
When the user changes the speed control the component preserves the
polar analysis state across the reset so that the interpolation can
continue smoothly, but the synthesis phase accumulator output_phase
was left drifting. Each output IFFT in stft_do_fft_ifft() advances
output_phase by an interpolated one-analysis-hop delta of the form
(1 - frac) * angle_delta_prev + frac * angle_delta, where frac is
the current interpolation position between two consecutive analysis
frames. That delta is added irrespective of the current speed, so at
non-unity speed output_phase runs faster than the true polar angle.
On top of that, the first post-reset IFFT does not consume a new
input FFT yet still applies its phase interpolation step (with
frac = 0, so the added term equals angle_delta_prev), which adds one
extra angle_delta_prev per reset. After a repeated excursion (for
example 1.0 -> 0.5 -> 1.0 with several intermediate steps) both
effects accumulate as a random per-bin phase offset that persists
after returning to unity speed. Perceptually this smears transients
and dulls the sound even though the audio is being processed at
speed 1.0 again.
The steady-state invariant at speed 1.0 is that after each IFFT's
phase interpolation step output_phase equals polar_prev.angle. To
preserve this invariant across a speed change, re-anchor output_phase
to polar_prev.angle minus angle_delta_prev in reset_for_new_speed().
The first post-reset IFFT then lands output_phase exactly on
polar_prev.angle, and all subsequent IFFTs advance normally with no
cumulative offset. Existing NULL and channel-count guards keep the
init-time call from touching buffers before they are allocated.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>1 parent 95b648c commit f5176b9
1 file changed
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
218 | 224 | | |
219 | 225 | | |
220 | 226 | | |
| |||
232 | 238 | | |
233 | 239 | | |
234 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
235 | 262 | | |
236 | 263 | | |
237 | 264 | | |
| |||
0 commit comments