bestAvailableAudioFormat(compatibleWith:considering:)
Retrieves the best-quality audio format that the specified modules can work with, taking into account the natural format of the audio and assets installed on the device.
Declaration
static func bestAvailableAudioFormat(compatibleWith modules: [any SpeechModule], considering naturalFormat: AVAudioFormat?) async -> AVAudioFormat?Parameters
- modules:
A list of modules that will be analyzing the audio.
- naturalFormat:
An audio format that you prefer to work with, or
nilif you have no preference.
Return Value
nil if the specified modules require you to install additional assets.
Discussion
Use this method to set up an audio pipeline or pre-convert audio to a usable format. In order to keep CMTime values sample-accurate, the analyzer does not transparently upsample, downsample, or convert audio input.