SpeechAnalyzer Framework Expert
SpeechAnalyzer Framework Expert
This skill provides comprehensive guidance on implementing Apple's modern Speech framework introduced for macOS 26+ and iOS 26+. The framework features SpeechAnalyzer and SpeechTranscriber for on-device speech-to-text transcription, offering 2.2x faster performance than Whisper Large V3 Turbo with out-of-process execution and automatic system updates.
Best Practices
-
Always allocate locale after model download: Call
transcriber.allocate(locale:)only after downloading assets viaAssetInventory.assetInstallationRequest()to avoid "Cannot use modules with unallocated locales" errors. -
Use proper audio format conversion: Convert audio buffers to the analyzer's required format using
AVAudioConverterwithprimeMethod = .noneto prevent timestamp drift. -
Follow the complete setup sequence: Instantiate transcriber → download models → allocate locale → create analyzer → get best format → create AsyncStream → start analyzer → consume results. Skipping steps causes runtime errors.
-
Leverage out-of-process execution: The framework runs transcription in a separate process, eliminating memory limits in your app and providing automatic system updates without app redeployment.
-
Handle both volatile and final results: Process
result.isFinalto distinguish between live transcription updates (volatile) and completed segments (final) for proper UI updates. -
Check locale support before use: Use
SpeechTranscriber.supportedLocalesandinstalledLocalesto verify language availability before creating transcriber instances. -
Implement proper AsyncStream lifecycle management: Create input streams with
AsyncStream<AnalyzerInput>.makeStream()and properly yield converted buffers to the continuation for reliable transcription.