Time-Stretch & Speed
Pitch-preserving time-stretch is libavfilter's rubberband filter, wrapped by vv_audio::stretch_samples. No extra bindings are needed: the system FFmpeg is built with librubberband. Stretching is used in two places.
Clip speed
pitch_correction | How the clip's audio is read |
|---|---|
true (default) | The clip's range is stretched by its speed with stretch_range, then played at step 1. In preview a background worker in mix_buffers.rs does the stretching; until it is ready the clip counts as pending. Export stretches synchronously. |
false | Varispeed: pitch follows speed. Slowing down uses linear interpolation; speeding up averages the skipped frames as a crude low-pass against aliasing. |
Fast-forward playback (2x / 4x / 8x)
Stretching a whole track would delay the first sound by seconds, so the preview stretches the mix in windows.

| Rule | Why |
|---|---|
| Windows of 8 s of timeline audio | One window comes back in ~150–200 ms. 8 s is a multiple of every tempo, so queued windows do not drift. |
| Next window when less than 4 s is left unplayed | At 8x that is 0.5 s of real time, more than the stretch takes. |
| At most one request in flight; stale results dropped | A seek or speed change while stretching must not play old audio. |
| 1x applies at once; 2x/4x/8x when the first window is ready | The stream is never reopened. The callback switches to render_stretched, which advances the position by frames × tempo. |
No comments to display
No comments to display