AVSpeechSynthesisProviderVoice audioFileSettings field

Hello,

the AVSpeechSynthesisVoice has a audioFileSettings attributes

let utterance = AVSpeechUtterance(string: text)
utterance.voice = AVSpeechSynthesisVoice(identifier: voiceSelected!)
print("- voice \(utterance.voice!.audioFileSettings)")
["AVLinearPCMIsBigEndianKey": 0, "AVLinearPCMIsFloatKey": 1, "AVLinearPCMIsNonInterleaved": 1, "AVNumberOfChannelsKey": 1, "AVSampleRateKey": 22050, "AVFormatIDKey": 1819304813, "AVLinearPCMBitDepthKey": 32]

This is declared in

AVSpeechSynthesisVoice {
...
@available(iOS 13.0, *)
open var **audioFileSettings:** [String : Any] { get }
@available(iOS 17.0, *)
open var voiceTraits: AVSpeechSynthesisVoice.Traits { get }
}

How can we specify the audioFileSettings attributes in a AVSpeechSynthesisProviderVoice ?

Cause in AVSpeechSynthesisProviderVoice there is no such field

AVSpeechSynthesisProviderVoice {
open var name: String { get }
open var identifier: String { get }
open var primaryLanguages: [String] { get }
open var supportedLanguages: [String] { get }
open var voiceSize: Int64
open var version: String
open var gender: AVSpeechSynthesisVoiceGender
open var age: Int
}

Regards

Apparently audioFileSettings is filled inside AVSpeechSynthesisProviderVoice automatically because on iOS 17 these information is well present on AVSpeechSynthesisVoice.audioFileSettings without doing anything AVSpeechSynthesisProviderVoice side.

But on iOS 18.x it comes back empty

@State private var voices: [AVSpeechSynthesisVoice] = []
List(voices.sorted(by: { $0.name < $1.name }), id: \.identifier) { voice in
print(voice.audioFileSettings)
}
iOS 17.4
["AVNumberOfChannelsKey": 1, "AVLinearPCMIsFloatKey": 1, "AVSampleRateKey": 22050, "AVLinearPCMIsBigEndianKey": 0, "AVLinearPCMBitDepthKey": 32, "AVLinearPCMIsNonInterleaved": 1, "AVFormatIDKey": 1819304813]
iOS 18.3.1 / 18.4
[:]
AVSpeechSynthesisProviderVoice audioFileSettings field
 
 
Q