我正在尝试使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>
知道我在做什么错吗?
答案 0 :(得分:0)
SpeechSynthesisUtterance
功能不支持阿拉伯语,only supports the following languages不支持它们的声音:
speechSynthesis.onvoiceschanged = function() {
var voices = this.getVoices();
console.log(voices);
};