问题
When I run speechSynthesis.getVoices()
in Chrome, I get a list of possible voices. The list changes depending on the computer and version of Chrome.
Is there any way I can extend support and add more voices?
I feel like this could be done by asking a user to download a voice file for their chosen language. Do such files exist?
Edit:
This needs to work for both Windows and Mac computers.
It also needs to be simple, so no scripts or anything that would require extensive technical knowledge. I'm hoping for a "download and install" type of thing
回答1:
HOW TO ADD MORE VOICE FROM MICROSOFT EDGE TO CHROME AND FIREFOX ( only on windows 10 fall creator update or later)
you should using show list voice test first at: show available voice on browser
chrome have local and server voice, edge have local and can download more, firefox have nothing else but only 3 supported voice locked by windows registy.
Here's the script to unlock:
If your not sure how to run a powershell script:
Click Start
search for 'Powershell'
launch Powershell (Since this is editing a LocalMachine key, you will need to run as admin). Copy and paste the script into the console. Press enter.
$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
}
After running this on my Example machine and restarting, I have the following voices available to the api
Microsoft David Desktop; Microsoft Zira Desktop; Microsoft Zira Mobile; (Same as the desktop counterpart) Microsoft Mark Mobile;
I find these voices to be superior to the Desktop variants, plus variety is always nice
that you can test your new voice here after restart: show available voice on browser
here I can have 10 voices than 3 voices before, on firefox. That even I can install Vietnamese voice with Microsoft An from windows language, and my firefox can read vietnamese as edge.
source reddit.com
来源:https://stackoverflow.com/questions/47379725/how-do-i-add-a-voice-language-to-speechsynthesis