javascript文本到语音阿拉伯语 [英] javascript Text to Speech arabic
本文介绍了javascript文本到语音阿拉伯语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试让 SpeechSynthesisUtterance
为阿拉伯语工作
I'm trying to make SpeechSynthesisUtterance
work for Arabic
它适用于英语
$(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
函数不支持阿拉伯语,仅支持以下语言及其各自的声音:
The SpeechSynthesisUtterance
function doesn't support Arabic, and only supports the following languages with their respective voices :
speechSynthesis.onvoiceschanged = function() {
var voices = this.getVoices();
console.log(voices);
};
这篇关于javascript文本到语音阿拉伯语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文