how to use the Speech framework

Asked on 06/18/2025

1 search

To use the Speech framework, particularly the new Speech Analyzer API introduced in iOS 26, you can follow these steps:

  1. Initialize the Speech Analyzer: The Speech Analyzer class manages an analysis session. You can add a module class to the session to perform a specific type of analysis, such as transcription.

  2. Add a Transcriber Module: By adding a transcriber module to the session, you create a transcription session that performs speech-to-text processing. You pass audio buffers to the analyzer instance, which then routes them through the transcriber and its Speech to Text model.

  3. Handle Asynchronous Processing: The model predicts the text that corresponds to the spoken audio and returns that text, along with some metadata, to your application. This process works asynchronously, allowing your application to add audio as it becomes available and process results independently.

  4. Use Swift's Async Sequences: Swift's async sequences help buffer and decouple the input and results, making the process efficient and responsive.

For a detailed demonstration, you can watch the session Bring advanced speech-to-text to your app with SpeechAnalyzer (02:41) where the Speech Analyzer API is discussed in depth.