Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/432.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在Web语音API中获得特定的女性语音合成?_Javascript_Google Chrome_Speech Synthesis - Fatal编程技术网

Javascript 如何在Web语音API中获得特定的女性语音合成?

Javascript 如何在Web语音API中获得特定的女性语音合成?,javascript,google-chrome,speech-synthesis,Javascript,Google Chrome,Speech Synthesis,我正在尝试从网络语音API中获取女性的声音“US English” 下面是我的代码: var synth = window.speechSynthesis; var voiceOptioins = synth.getVoices(); var voiceChoice = voiceOptioins[5]; var utterThis = new SpeechSynthesisUtterance(textToSpeech); utterThis.voice = voiceChoice; syn

我正在尝试从网络语音API中获取女性的声音“US English”

下面是我的代码:

var synth = window.speechSynthesis;
var voiceOptioins = synth.getVoices();
var voiceChoice = voiceOptioins[5];

var utterThis = new SpeechSynthesisUtterance(textToSpeech);
utterThis.voice = voiceChoice;

synth.speak(utterThis);
有了这个密码,现在一个男声会发出超低音。我已尝试更改
voiceOptioins[]
中的索引:尝试使用0、5、10。在所有这些指标中,只有相同的男性声音出现


如何选择特定的语音?

4很好。她听起来像是英国人。我是从美国口音看的,但英国口音对我的聊天机器人来说似乎更清晰。因此,选择4。谢谢,不过要小心。系统之间的指数可能不一致4良好。她听起来像是英国人。我是从美国口音看的,但英国口音对我的聊天机器人来说似乎更清晰。因此,选择4。谢谢,不过要小心。系统之间的索引可能不一致