3

I have a Text to Speech App and all is good, but I was looking for a voice.

In Settings/Accessibility/Voice Over/Speech/Voice there is a list of voices. I wanted to select one of those, for example "Susan (Enhanced)". How would I go about doing that?

I am new to Text to Speech and AVSpeechSynthesizer so I was hoping for some advice how to select that voice?

When I try it in General/Settings it sounds good, but when I select, what I thought was that voice it in my App, it sounds different. This happens with all of the voices I tried.

Here is the code I used to speak the text:

    for voice in AVSpeechSynthesisVoice.speechVoices()
    {
        print("\(voice.name)")
        if voice.name == "Susan (Enhanced)" {
            self.voiceToUse = voice
        }
    }

    let textToSpeak = self.tvTextToSpeak.text
    if (!textToSpeak!.isEmpty)
    {
        let speechSynthesizer = AVSpeechSynthesizer()
        let speechUtterance: AVSpeechUtterance = AVSpeechUtterance(string: textToSpeak!)
        speechUtterance.voice = self.voiceToUse
        speechSynthesizer.speak(speechUtterance)
    }

So if I use the same text as the example in the iOS settings it sounds different in my App, why?

  1. Is it something I need to do?
  2. Are those voices special?
  3. Does it have to do with the utterance, I have not set that.

Thanks for any clarification.

LilMoke
  • 3,176
  • 7
  • 48
  • 88
  • Is it a Siri voice? You are not permitted to specify one of those. – matt Sep 27 '20 at 04:23
  • Hmm, I am not sure when I read about AVSpeechSynthesisVoice.speechVoices() I did not read any mention of siri. And am I able to list them and specify a voice if I cannot use them? – LilMoke Sep 28 '20 at 04:41
  • That’s why I’m telling you about it! I’m telling you that if you ask for a Siri voice you won’t get it. Now I ask you again, is this a Siri voice? Because if it is, that’s why. – matt Sep 28 '20 at 13:11
  • Well, first off thank you for all your help but my question is why would Siri serve up all those available voice if I can't use them that's number one but number two I understand what you're saying how can I tell if Siri voice or not in the speech control panel it's listed there does that mean it's a Siri voice and if that's true then how can I get a list of the voices that are available that I can use if I can't use the list it's giving me from the call I showed above I hope that makes sense thank you again – LilMoke Sep 29 '20 at 15:26
  • What I’m saying is, asking for a Siri voice and getting a different voice is not a bug. – matt Sep 29 '20 at 18:45
  • @matt Can you elaborate on "is not permitted"? Is there a part in the iOS documentation that says that we can't access them, even if the user has set some enhanced Siri voice as their default? – Felix Jassler Oct 24 '22 at 10:37

1 Answers1

0

Many of the voices, especially the "enhanced" ones, need to be downloaded on the device first. On your device go to Settings->Accessibility->Spoken Content->Voices, and make sure that you download the voice that you're trying to use.

I was able to use "Samantha (Enhanced)", once I downloaded it.

Marcus Adams
  • 53,009
  • 9
  • 91
  • 143