feat: implement PipecatSmartTurn backend#9
Merged
wavekat-eason merged 7 commits intomainfrom Mar 28, 2026
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- build.rs: download smart-turn-v3.2-cpu.onnx at build time with
version caching and PIPECAT_SMARTTURN_MODEL_{PATH,URL} overrides
- src/onnx.rs: shared session_from_file / session_from_memory helpers
- src/audio/pipecat.rs: full implementation
- MelExtractor: Slaney mel filterbank, periodic Hann window, realfft STFT
- PipecatSmartTurn::new() (embedded model) and from_file(path)
- push_audio: 16 kHz ring buffer, 8s capacity, wrong-rate frames dropped
- predict: mel features → ONNX inference → TurnPrediction
- reset: clears ring buffer
- tests/pipecat.rs: 9 integration tests; RTF < 50ms enforced in release
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add StageTiming struct and stage_times field to TurnPrediction - Instrument predict() with three stages: audio_prep, mel, onnx - Incremental STFT: cache power spectrogram and shift on each call, recomputing only the ~50 new frames instead of all 801 (~16x faster) - Incremental mel filterbank: cache mel_spec and update only new columns, reducing matmul from [80×201]×[201×800] to [80×201]×[201×50] (~16x) - Invalidate caches on reset() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merged
wavekat-eason
pushed a commit
that referenced
this pull request
Mar 28, 2026
## 🤖 New release * `wavekat-turn`: 0.0.3 -> 0.0.4 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.0.4](v0.0.3...v0.0.4) - 2026-03-28 ### Added - implement PipecatSmartTurn backend ([#9](#9)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PipecatSmartTurnturn detector using the Pipecat Smart Turn v3.2 ONNX model (int8 quantized, ~8 MB, ~12 ms CPU inference)build.rsto download the model at build time with version-aware caching; supportsPIPECAT_SMARTTURN_MODEL_PATHoverride and docs.rs no-network buildsonnx.rsTurnPredictionwithstage_times: Vec<StageTiming>for per-stage latency breakdownfrom_fileerror pathsTest plan
cargo test --features pipecat— unit and integration tests passPIPECAT_SMARTTURN_MODEL_PATHpointing to a local.onnxfile — skips downloadDOCS_RS=1— writes zero-byte placeholder, compiles without network🤖 Generated with Claude Code