Streaming for ASR - #79
Conversation
There was a problem hiding this comment.
Comprehensive code review completed. This PR significantly improves FluidAudio's streaming ASR capabilities with excellent API design and examples.
Key Strengths:
- Dual-stream architecture (
resultsvssnapshots) elegantly separates detailed events from UI updates - Production-quality SwiftUI and UIKit examples with proper patterns
- Well-tuned
.realtimeconfiguration for responsive transcription
Critical Issue to Address:
- Memory leak risk:
finalizedSegmentsandsegmentFinalTextscollections grow unbounded during long sessions (could accumulate thousands of segments in memory)
Recommendations:
- Implement segment cleanup mechanism for long-running sessions
- Consider structured concurrency patterns in audio callback examples
- Add migration guide for API changes
Overall, this is a solid architectural improvement that addresses real-world streaming ASR needs effectively. The memory management issue should be resolved before merge.
Speaker Diarization Benchmark ResultsSpeaker Diarization PerformanceEvaluating "who spoke when" detection accuracy
Diarization Pipeline Timing BreakdownTime spent in each stage of speaker diarization
Speaker Diarization Research ComparisonResearch baselines typically achieve 18-30% DER on standard datasets
Note: RTFx shown above is from GitHub Actions runner. On Apple Silicon with ANE:
🎯 Speaker Diarization Test • AMI Corpus ES2004a • 1049.0s meeting audio • 53.4s diarization time • Test runtime: 1m 35s • 09/08/2025, 11:58 PM EST |
ASR Benchmark Results ✅Status: All benchmarks passed
🚀 Streaming Performance Test
Streaming test validates --streaming option with 5 files using 0.5s chunks to simulate real-time audio streaming 25 files per dataset • Test runtime: 3m41s • 09/09/2025, 12:01 AM EST RTFx = Real-Time Factor (higher is better) • Calculated as: Total audio duration ÷ Total processing time Expected RTFx Performance on Physical M1 Hardware:• M1 Mac: ~28x (clean), ~25x (other) Testing methodology follows HuggingFace Open ASR Leaderboard |
VAD Benchmark ResultsPerformance Comparison
Dataset Details
✅: Average F1-Score above 70% |
72a877b to
260e7f3
Compare
260e7f3 to
afb238a
Compare
|
@claude review the whole PR |
| [](https://deepwiki.com/FluidInference/FluidAudio) | ||
|
|
||
|
|
||
| Fluid Audio is a Swift framework for fully local, low-latency audio processing on Apple devices. It provides state-of-the-art speaker diarization, ASR, and voice activity detection through open-source models (MIT/Apache 2.0 licensed) that we've converted to Core ML. |
There was a problem hiding this comment.
Claude finished @BrandonWeng's task —— View job
README.md Review Complete ✅
I've thoroughly reviewed the updated README.md and cross-referenced it with the actual implementation. The documentation is accurate and well-written, with only one minor typo to fix:
Issues Found
Line 27: Typo
- **Cross-platform**: Support for macOS 14.0+ and iOS 17.0+ and Apple Sillicon device
+ **Cross-platform**: Support for macOS 14.0+ and iOS 17.0+ and Apple Silicon device(Note: "Sillicon" should be "Silicon")
What I Verified ✅
- Streaming API Examples: All code examples match the actual
StreamingAsrManagerimplementation - Configuration Options: The
StreamingAsrConfig.realtimeand.defaultpresets exist exactly as documented - CLI Commands: The
--streamingflag and commands are implemented correctly - Performance Numbers: RTFx and benchmarking data aligns with CI results
- API Consistency: Both single-stream and multi-stream examples are accurate
- Parameter Documentation: All config parameters like
chunkSeconds,leftContextSeconds, etc. match the implementation
Strengths
- Comprehensive Coverage: Excellent documentation of both batch and streaming modes
- Practical Examples: Real-world usage patterns with proper async/await syntax
- Performance Context: Clear RTFx explanations and hardware-specific expectations
- Configuration Guidance: Well-explained parameter impacts on latency vs accuracy
The streaming ASR documentation is production-ready and accurately reflects the implementation. Just fix the "Sillicon" typo and it's perfect.
| - name: Cache iOS Platform | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform | ||
| key: ios-platform-${{ runner.os }}-xcode-${{ hashFiles('/Applications/Xcode.app/Contents/version.plist') }} | ||
| restore-keys: | | ||
| ios-platform-${{ runner.os }}-xcode- |
There was a problem hiding this comment.
not a huge file so easier to redownload, notice that hte cahce doesn't work all the time anyways
| @@ -1,441 +0,0 @@ | |||
| Hello! I’m Donovan, an engineer on the Speech framework team and I’m Shantini, an engineer on the Notes team. | |||
There was a problem hiding this comment.
not very useful for us here
| [](https://developer.apple.com) | ||
| [](https://discord.gg/WNsvaCtmDe) | ||
| [](https://huggingface.co/collections/FluidInference/coreml-models-6873d9e310e638c66d22fba9) | ||
| [](https://deepwiki.com/FluidInference/FluidAudio) |
There was a problem hiding this comment.
Moved around the sections a bit and cleanedu p the phrases as well
There was a problem hiding this comment.
Artificial delay when streaming or else its too fast, and you can't even see it
There was a problem hiding this comment.
is this all from the parakeet python code
There was a problem hiding this comment.
nope, parakeet python code's streaming implementation requires a bit too much time, its not responsive enough. Takes inspiration from it and the apple streaming API
There was a problem hiding this comment.
where is the apple streaming api doc from
There was a problem hiding this comment.
is this gonna be frequent ? removeFirst is like O(n)
|
i gues we will watch out for deadlocks , race conditions and possible memory leaks. the keep priority code being asrmanager.swift |
2abad6e to
eb93191
Compare
The Cross-Platform Build Check was failing on main branch pushes due to a race condition where iOS simulators were listed as available but not yet accessible to xcodebuild. Changes: - Add xcodebuild verification step with 5-attempt retry mechanism - Wait for simulator to be fully available before build attempts - Add diagnostic output showing available destinations - Implement UUID-based fallback as final attempt - Improve error messages and debugging information This eliminates the timing issue causing "Unable to find a device matching the provided destination specifier" errors. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
a40d91e to
dd8b8c9
Compare
|
are the streaming prefixes necessary for the streaming asr files ? |
Lets keep it, or else hard to know which is which. |
Hi, is the code running in this demo video listening to the speakers of your device or did you somehow duplicated the sound output to a virtual device and redirected it to the running streaming ASR? I'm asking because I'm currently trying to find easy-to-implement native ways to do so. |
Oh no, in this case it was just listening to the microphone, |
|
Thanks for the awesome package, it's been great to work with so far. I know this feature isn't final yet, but just wanted to share some issues I'm seeing. The screenshot below is a csv dump of streamingAsr.segmentUpdates taken from playing this video into my microphone: https://www.youtube.com/watch?v=s0EbxhQYeCA If you look at lines 33 and 34, as the segment moves from volatile to stable a bunch of the segment text is lost. I see this often when using the .balanced profile.
There's also other weirdness between volatile and stable updates. Seems to happen most often around the boundaries of chunkDuration. For example, volatile line 17 ends in "But", but it's removed from the stable line 18, and only appears again at the beginning of the next stable update on line 24. |
Thanks a bunch for the feedback @benbjurstrom - I've been distracted with the VAD model improvements. Hoping to revisit streaming ASR next week 🙏 |
|
Going to close this for now, drifted too far from main and haven't been able to find time to work on this |
Are there any examples to demo the |


Why is this change needed?
Adding support for ASR streaming. Majority of the change is in
Sources/FluidAudio/ASR/Streaming/StreamingAsrManager.swifte.g
swift run fluidaudio transcribe GLM\ 4.5.wav --streamingClipboard-20250826-052557-193.mp4
stt.mp4