JavaScript的文本到语音阿拉伯语

问题描述 投票:2回答:1

我试图做出阿拉伯语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>

任何想法,我做错了什么?

javascript jquery text-to-speech
1个回答
0
投票

SpeechSynthesisUtterance功能不支持阿拉伯语,并用各自的声音only supports the following languages

speechSynthesis.onvoiceschanged = function() {
  var voices = this.getVoices();
  console.log(voices);
};
© www.soinside.com 2019 - 2024. All rights reserved.