-
-
Notifications
You must be signed in to change notification settings - Fork 544
Expand file tree
/
Copy pathlist-voices.ps1
More file actions
executable file
·31 lines (28 loc) · 841 Bytes
/
list-voices.ps1
File metadata and controls
executable file
·31 lines (28 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<#
.SYNOPSIS
List installed text-to-speech voices
.DESCRIPTION
This PowerShell script queries the installed text-to-speech (TTS) voices and prints them to the console.
.EXAMPLE
PS> ./list-voices.ps1
Name Culture Gender Age
---- ------- ------ ---
Microsoft David Desktop en-US Male Adult
...
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
Add-Type -AssemblyName System.Speech
$synth = New-Object System.Speech.Synthesis.SpeechSynthesizer
$synth.GetInstalledVoices() |
Select-Object -ExpandProperty VoiceInfo |
Select-Object -Property Name, Culture, Gender, Age
exit 0 # success
} catch {
"⚠️ ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1
}