Added speak-test.ps1

This commit is contained in:
Markus Fleschutz
2020-12-31 10:02:08 +00:00
parent 21a23422e1
commit 8ca2159d87
3 changed files with 26 additions and 0 deletions

24
Scripts/speak-test.ps1 Executable file
View File

@ -0,0 +1,24 @@
#!/snap/bin/powershell
<#
.SYNTAX ./speak-test.ps1
.DESCRIPTION performs a test speak by text-to-speech (TTS)
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
try {
$Voice = new-object -ComObject SAPI.SPVoice
$Voice.Speak("This is the default voice")
$Voice.Speak("Let's also try the other voices")
$Voices = $Voice.GetVoices()
foreach ($OtherVoice in $Voices) {
$OtherVoice.GetDescription()
$Voice.Voice = $OtherVoice
$Voice.Speak("1 2 3 - this is a test")
}
exit 0
} catch {
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}