Fix AudioProcessingTrack per-sample loop performance#633
Fix AudioProcessingTrack per-sample loop performance#633BuffMcBigHuge merged 1 commit intomarco/feat/audio-sync-2from
Conversation
…ioProcessingTrack Addresses review feedback on #534. The audio buffer interleaving and frame extraction used O(n) Python loops over individual samples, which is expensive for real-time audio. Now uses np.ravel(order="F") for interleaving and numpy slicing for frame extraction. Also adds 42 tests covering interleaving, buffering, resampling, channel conversion, frame construction, and adversarial inputs. Signed-off-by: RyanOnTheInside <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🚀 fal.ai Preview Deployment
TestingConnect to this preview deployment by setting the fal endpoint in your client: 🧪 E2E tests will run automatically against this deployment. |
✅ E2E Tests passed
Test ArtifactsCheck the workflow run for screenshots. |
Summary
AudioProcessingTrackwith vectorized numpy operations, addressing review feedbackrecv()integration with adversarial inputsChanges
src/scope/server/tracks.pydeque[float]tonp.ndarray(float32)np.ravel(order="F")instead of nestedforloopspopleft()_create_audio_frameacceptsnp.ndarraydirectly, skipping redundant conversiontests/test_audio_processing_track.py(new)recv()integration (no audio, resampling, mono upmix, 1D tensor, pause, accumulation)Test plan
uv run pytest tests/test_audio_processing_track.py)