Pierluigi Rizzu
Pierluigi Rizzu

Reputation: 15

AVFoundation Recording Audio Feature, how to change language?

I want to implement the AVFoundation recording system (NOT SPEECH) but it seems to be set to detect only english. Is there any parameter to change?

Upvotes: 0

Views: 102

Answers (1)

user12688502
user12688502

Reputation:

Check language codes by:

for voice in (AVSpeechSynthesisVoice.speechVoices()){
        print(voice.language)
    }

and the get it by below code:

let speakTalk   = AVSpeechSynthesizer()
let speakMessage    = AVSpeechUtterance(string: "Hello, How are you?")

speakMessage.voice  = AVSpeechSynthesisVoice(language: "en-US")
speakMessage.pitchMultiplier = 1.2
speakMessage.rate   = 0.5

speakTalk.speak(speakMsg)

It is what you need?

Upvotes: 1

Related Questions