I have converted text to speech using the AVSpeechSynthesizer
. When clicked on Play, converted speech plays. I don't know the extension of this audio file.
My goal is to convert this created audio file to .mp3. I have searched in Google but I didn't find anything. Any help is appreciated.
My code is here: Convert text to speech
text = UserDefaults.standard.string(forKey: "TextString")!
voice = selectCountryDic["Clanguage"]!
let speechText = AVSpeechUtterance(string:text)
speechText.voice = AVSpeechSynthesisVoice(language:voice)
let synthesizer = AVSpeechSynthesizer()
synthesizer.speak(speechText)