通过这个简单的 PowerShell 脚本,您可以在 Windows 上列出并使用文本转语音 (tts):
Add-Type -AssemblyName System.speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.GetInstalledVoices()|ForEach-Object { $_.VoiceInfo }
这会列出已安装的 TTS 语音:
Gender : Male
Age : Adult
Name : Microsoft David Desktop
Culture : en-US
Id : TTS_MS_EN-US_DAVID_11.0
Description : Microsoft David Desktop - English (United States)
SupportedAudioFormats : {}
AdditionalInfo : {[Age, Adult], [Gender, Male], [Language, 409], [Name, Microsoft David 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]...}
但是,在最新的 Windows 11 更新(2023)
之后,脚本无法列出为讲述人新添加的自然语音要查看这些语言,您可以访问
Settings > Accessibility > Narrator
似乎这些在 System.Speech.Synthesis Namespace 中不可用,但你知道如何从 PowerShell 访问这些语音吗?例如:
Microsoft Jenny (Natural)
?
那么这个问题有解决办法吗?我看到“辅助功能讲述人”中列出了许多声音,但它们未在 System.Speech.Synthesis.SpeechSynthesizer 文本转语音模块中注册或访问。