How to use speech.say() in different voice?
If you check the setting in iOS you will find that voice can be spoken in different people:
en-US: the default is Samantha(female), there is Fred(male), and you also can download Allison, Ava, Nick... as well as Siri
How can we use them in
The propose is because that the quality of default voice of
zh-cnis terrible which is read by Tian-Tian, but I check others like Ting-Ting or female Siri, the quality is much better.
Does anyone know how to change the setting?
I just tested it and it's ok but I changed a little bit to find the wanted voice
voices=AVSpeechSynthesisVoice.speechVoices() for i in range(0,len(voices)): print(i,voices[i]) ... #voice=AVSpeechSynthesisVoice.voiceWithLanguage_('fr-FR') voice = voices
Awesome!!!!!!!! ~~~~ Thanks a lot!!!
Remark that speech.get_languages() gives 53 elements like AVSpeechSynthesisVoice.speechVoices() but speech module does not allow, I think, to select particular voice for the same language...
@omz the script here-after shows that the speech module 'knows' all the 53 languages offered by the Apple module, it could be possible to get a wanted voice by passing to the say function the language and, for instance, the voice name, isn'it?
import speech from objc_util import * AVSpeechSynthesisVoice=ObjCClass('AVSpeechSynthesisVoice') l1 = speech.get_synthesis_languages() l2 = AVSpeechSynthesisVoice.speechVoices() for i in range(0,len(l1)): l = str(l2[i].description()) j = l.find('Language: ') k = l.find(', Quality:') # [AVSpeechSynthesisVoice 0x1c0a15f40] Language: ar-SA, Name: Maged, Quality: Default [com.apple.ttsbundle.Maged-compact] print('speech:',l1[i],'Objective-c:',l[j+10:k])```