---
title: "bestAvailableAudioFormat(compatibleWith:considering:)"
framework: speech
role: symbol
role_heading: Type Method
path: "speech/speechanalyzer/bestavailableaudioformat(compatiblewith:considering:)"
---

# 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

```swift
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 nil if you have no preference.

## Return Value

Return Value nil if the specified modules require you to install additional assets.

## Discussion

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.

## See Also

### Determining audio formats

- [bestAvailableAudioFormat(compatibleWith:)](speech/speechanalyzer/bestavailableaudioformat(compatiblewith:).md)
