列出并选择已安装的语音(用于文本到语音)
Listing and selecting installed voice (for text to speech)
如这里所见(原谅法语 UI),我的计算机上安装了 3 个文本到语音的语音:
然而,当我运行:
Add-Type -AssemblyName System.Speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.GetInstalledVoices().VoiceInfo
只有returns "Microsoft Zira Desktop":
Gender : Female
Age : Adult
Name : Microsoft Zira Desktop
Culture : en-US
Id : TTS_MS_EN-US_ZIRA_11.0
Description : Microsoft Zira Desktop - English (United States)
SupportedAudioFormats : {}
AdditionalInfo : {[Age, Adult], [Gender, Female], [Language, 409], [Name, Microsoft Zira Desktop]...}
我的目标是能够列出所有已安装的语音,然后 select 使用 PowerShell 列出一个。
我真的很困惑为什么这些声音可以工作并且可以在 UI 中 selected 而不是通过 PowerShell?
感谢 Jeff Zeitlin 为我指明了正确的方向!
您必须将声音复制到注册表中的不同路径。 GitHub 中的这个脚本可以解决问题:) 现在可以在 PowerShell 和其他第三方程序中使用和选择所有语音!
$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
}
https://gist.github.com/hiepxanh/8b6ad80f6d620cd3eaaaa5c1d2c660b2
详细解释:https://www.reddit.com/r/Windows10/comments/96dx8z/how_unlock_all_windows_10_hidden_tts_voices_for/
如这里所见(原谅法语 UI),我的计算机上安装了 3 个文本到语音的语音:
然而,当我运行:
Add-Type -AssemblyName System.Speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.GetInstalledVoices().VoiceInfo
只有returns "Microsoft Zira Desktop":
Gender : Female Age : Adult Name : Microsoft Zira Desktop Culture : en-US Id : TTS_MS_EN-US_ZIRA_11.0 Description : Microsoft Zira Desktop - English (United States) SupportedAudioFormats : {} AdditionalInfo : {[Age, Adult], [Gender, Female], [Language, 409], [Name, Microsoft Zira Desktop]...}
我的目标是能够列出所有已安装的语音,然后 select 使用 PowerShell 列出一个。
我真的很困惑为什么这些声音可以工作并且可以在 UI 中 selected 而不是通过 PowerShell?
感谢 Jeff Zeitlin 为我指明了正确的方向!
您必须将声音复制到注册表中的不同路径。 GitHub 中的这个脚本可以解决问题:) 现在可以在 PowerShell 和其他第三方程序中使用和选择所有语音!
$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
}
https://gist.github.com/hiepxanh/8b6ad80f6d620cd3eaaaa5c1d2c660b2
详细解释:https://www.reddit.com/r/Windows10/comments/96dx8z/how_unlock_all_windows_10_hidden_tts_voices_for/