我正在尝试让 SpeechSynthesisUtterance
为阿拉伯语工作
它对英语工作正常
$(document).ready(function() {
var u1 = new SpeechSynthesisUtterance('Hello world!');
u1.lang = 'en-US';
u1.pitch = 20;
u1.rate = 1;
u1.voiceURI = 'native';
u1.volume = 1000;
speechSynthesis.speak(u1);
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
但是当使用阿拉伯语时
$(document).ready(function() {
var u1 = new SpeechSynthesisUtterance('عربي');
u1.lang = 'ar-AE';
u1.pitch = 20;
u1.rate = 1;
u1.voiceURI = 'native';
u1.volume = 1000;
speechSynthesis.speak(u1);
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
知道我做错了什么吗?
最佳答案
SpeechSynthesisUtterance
函数不支持阿拉伯语,并且 only supports the following languages用他们各自的声音:
speechSynthesis.onvoiceschanged = function() {
var voices = this.getVoices();
console.log(voices);
};
关于javascript 文本到语音阿拉伯语,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54591028/