One Logo Pool Ball
Speech · IOS API REFERENCE

SpeechDetector

class · iOS 26.0+ · SDK 27.1

final class SpeechDetector

A module that performs a voice activity detection (VAD) analysis. This module asks "is there speech?" and provides you with the ability to gate transcription by the presence of voices, saving power otherwise used by attempting to transcribe what is likely to be silence. To enable voice activated transcription, initialize a ``SpeechDetector`` module. Like any other module, it can be set when first initializing SpeechAnalyzer: ``` let transcriber = SpeechTranscriber(..) let speechDetector = SpeechDetector() let analyzer = SpeechAnalyzer(.., modules: [speechDetector, transcriber]) ``` or later on with ``SpeechAnalyzer/setModules(_:)-9xd6w``: ``` let analyzer = SpeechAnalyzer(..) let transcriber = SpeechTranscriber(..) let speechDetector = SpeechDetector() try await analyzer.setModules([transcriber, speechDetector]) ``` > Important: This module only functions in conjunction with a ``SpeechTranscriber`` or ``DictationTranscriber`` module. > Note: For certain use cases, such as those with a lot of silence, it might be tempting to always enable voice activated transcription. But if the model drops audio that does contain speech, there could be a tradeoff between the power being saved by always having VAD enabled and potentially lower accuracy transcriptions. You can set the aggressiveness of the VAD model with ``SpeechDetector/SensitivityLevel``. While ``SpeechDetector/SensitivityLevel/medium`` is recommended for most use cases, the value of these tradeoffs will be context-specific.

Members (4)

init · iOS 26.0+

init

TypeScript
static initDetectionOptionsReportResults(detectionOptions: SpeechDetector_DetectionOptions, reportResults: boolean): SpeechDetector
Swift declaration
init(detectionOptions: SpeechDetector.DetectionOptions, reportResults: Bool)

Creates a speech detector. - Parameters: - detectionOptions: Instance of ``SpeechDetector/DetectionOptions`` that allows clients to customize the behavior of ``SpeechDetector`` beyond its default settings. - reportResults: Enables the ``SpeechDetector/results`` sequence to report the VAD model's results (and any relevant errors) back to clients. The default behavior is that ``SpeechDetector`` does not report results or errors back to the client and merely enables VAD as a power optimization.

get · iOS 26.0+

availableCompatibleAudioFormats

TypeScript
get availableCompatibleAudioFormats(): Array<_AVFAudio_AVAudioFormat>
Swift declaration
final var availableCompatibleAudioFormats: [AVAudioFormat] { get }

The audio formats that this module is able to analyze, given its configuration. If the audio format doesn't matter, then there will be one format listed with a sample rate of `kAudioStreamAnyRate` and other values 0. If assets are necessary yet not installed on device, then the list will be empty. This property may be accessed before the module is added to the analyzer.

get · iOS 26.0+

results

TypeScript
get results(): (SDKHandle) & (SDKHandle)
Swift declaration
final var results: some Sendable & AsyncSequence<SpeechDetector.Result, any Error> { get }

The asynchronous sequence of speech detection results. This sequence may throw an error, but will otherwise remain empty. Accessing this property does not create a new sequence.

init · iOS 26.0+

init

TypeScript
static init(): SpeechDetector
Swift declaration
convenience init()

Creates a speech detector with default settings. The default settings enable the VAD model with a value of ``SpeechDetector/SensitivityLevel/medium`` and do not report the VAD model's moment-to-moment results in its result sequence.

Skipped declarations

No declarations were skipped in this snapshot.

All Speech types →