Commits
Commits on
fbc29d12fa2e194b105dd2344342fc50da4e90cdFiltered to crates/engine/src/stretch.rsClear filter2026-08-15
✨ feat(engine): a speeded clip keeps its pitchAhmet Kaan Gümüş · 475f10c
✨ feat(engine): a speeded clip keeps its pitch The tape effect is gone: a speeded clip's audio was resampled at its speed, so its pitch moved with its rate. The resample is now only what it always should have been -- the rate conversion, reading a source written at another sample rate at the ratio of the two rates, pitch- true by construction -- and the time the Speed asks for is taken by a WSOLA stretch behind it: windows overlap-added at a different hop, each placed where it best continues the one before it, so the timeline compresses or stretches while every period of the signal keeps its own length. The beep stays a 1 kHz beep at 2x, the words stay spoken. Hand-rolled, no new dependencies: N=1024 Hann windows, 512-frame synthesis hop, ±512 search on the first channel by normalized cross- correlation against the natural continuation, one offset for every channel so a stereo pair stays coherent. A silent continuation is placed nominally -- nothing to match -- and a segment too short to prime a window passes through as the decoder read it. Both halves of the chain pace the timeline's promise to the frame, which is the A/V sync invariant the speed suite pins. Measured, not felt: the stretch's own tests put a 440 Hz sine through 2x and 0.5x and read 440 back by Goertzel with the octave gone; the sync fixture's 1 kHz beep plays at 1 kHz at 2x and 0.5x through the real open path (the tape effect's ladder peak read 1350 Hz there), and a 2x WAV export carries the same 1 kHz back out.