Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/363.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 如何将语音/语言添加到speechSynthesis?_Javascript_Text To Speech_Voice_Speech Synthesis_Webspeech Api - Fatal编程技术网

Javascript 如何将语音/语言添加到speechSynthesis?

Javascript 如何将语音/语言添加到speechSynthesis?,javascript,text-to-speech,voice,speech-synthesis,webspeech-api,Javascript,Text To Speech,Voice,Speech Synthesis,Webspeech Api,在Chrome中运行speechSynthesis.getVoices()时,我会得到一个可能的声音列表。列表根据计算机和Chrome版本的不同而变化 我有没有办法扩大支持,增加更多的声音 我觉得这可以通过要求用户下载他们所选语言的语音文件来实现。是否存在此类文件 编辑: 这需要适用于Windows和Mac计算机 它还需要简单,所以没有脚本或任何需要广泛技术知识的东西。我希望有一种“下载并安装”的方式如何将更多的声音从MICROSOFT EDGE添加到CHROME和FIREFOX(仅在windo

在Chrome中运行
speechSynthesis.getVoices()
时,我会得到一个可能的声音列表。列表根据计算机和Chrome版本的不同而变化

我有没有办法扩大支持,增加更多的声音

我觉得这可以通过要求用户下载他们所选语言的语音文件来实现。是否存在此类文件

编辑:

这需要适用于Windows和Mac计算机

它还需要简单,所以没有脚本或任何需要广泛技术知识的东西。我希望有一种“下载并安装”的方式

如何将更多的声音从MICROSOFT EDGE添加到CHROME和FIREFOX(仅在windows 10 fall creator update或更高版本上) 您应首先在以下位置使用显示列表语音测试:

chrome有本地和服务器语音,edge有本地语音,可以下载更多,firefox只有3个受windows注册表锁定的支持语音

以下是要解锁的脚本:

如果您不确定如何运行powershell脚本:

单击开始

搜索“Powershell”

启动Powershell(因为这是在编辑LocalMachine密钥,所以您需要以管理员身份运行)。将脚本复制并粘贴到控制台中。按回车键

$sourcePath = 'HKLM:\software\Microsoft\Speech_OneCore\Voices\Tokens' #Where the OneCore voices live
$destinationPath = 'HKLM:\SOFTWARE\Microsoft\Speech\Voices\Tokens' #For 64-bit apps
$destinationPath2 = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens' #For 32-bit apps
cd $destinationPath
$listVoices = Get-ChildItem $sourcePath
foreach($voice in $listVoices)
{
$source = $voice.PSPath #Get the path of this voices key
copy -Path $source -Destination $destinationPath -Recurse
copy -Path $source -Destination $destinationPath2 -Recurse
}
在我的示例机器上运行并重新启动后,api可以听到以下声音

微软大卫桌面; 微软Zira桌面; 微软Zira移动;(与台式机相同) 微软马克移动

我发现这些声音要优于台式机的变体,加上多样性总是很好的

重新启动后,您可以在此处测试新语音:

在firefox上,我可以有10种声音,而不是以前的3种。甚至我可以用微软的windows语言安装越南语语音,我的firefox也可以把越南语读作edge。


来源

为什么/如何工作?我还需要一些更简单、更通用的东西。我不能要求用户编写脚本。我的大多数用户都在Mac上我不使用Mac,抱歉我帮不了你