Update the scripts

This commit is contained in:
Markus 2021-09-27 17:16:29 +02:00
parent b653133853
commit 75e2952be0
5 changed files with 31 additions and 36 deletions

View File

@ -16,13 +16,12 @@ param([string]$text = "")
try {
if ("$text" -eq "") { $text = read-host "Enter the English text to speak" }
$Voice = New-Object -ComObject SAPI.SPVoice
$Voices = $Voice.GetVoices()
foreach ($OtherVoice in $Voices) {
$Description = $OtherVoice.GetDescription()
if ($Description -notlike "*- English*") { continue }
$Voice.Voice = $OtherVoice
[void]$Voice.Speak($text)
$CurrentVoice = New-Object -ComObject SAPI.SPVoice
$Voices = $CurrentVoice.GetVoices()
foreach ($Voice in $Voices) {
if ($Voice.GetDescription() -notlike "*- English*") { continue }
$CurrentVoice.Voice = $Voice
[void]$CurrentVoice.Speak($text)
exit 0 # success
}
throw "No English text-to-speech voice found - please install one"

View File

@ -16,13 +16,12 @@ param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the French text to speak" }
$Voice = New-Object -ComObject SAPI.SPVoice
$Voices = $Voice.GetVoices()
foreach ($OtherVoice in $Voices) {
$Description = $OtherVoice.GetDescription()
if ($Description -notlike "*- French*") { continue }
$Voice.Voice = $OtherVoice
[void]$Voice.Speak($text)
$CurrentVoice = New-Object -ComObject SAPI.SPVoice
$Voices = $CurrentVoice.GetVoices()
foreach ($Voice in $Voices) {
if ($Voice.GetDescription() -notlike "*- French*") { continue }
$CurrentVoice.Voice = $Voice
[void]$CurrentVoice.Speak($text)
exit 0 # success
}
throw "No French text-to-speech voice found - please install one"

View File

@ -2,7 +2,7 @@
.SYNOPSIS
speak-german.ps1 [<text>]
.DESCRIPTION
Speaks the given text with a German text-to-speech (TTS) voice.
Speaks the given text with a German text-to-speech (TTS) voice
.EXAMPLE
PS> ./speak-german Hallo
.NOTES
@ -16,13 +16,12 @@ param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the German text to speak" }
$Voice = New-Object -ComObject SAPI.SPVoice
$Voices = $Voice.GetVoices()
foreach ($OtherVoice in $Voices) {
$Description = $OtherVoice.GetDescription()
if ($Description -notlike "*- German*") { continue }
$Voice.Voice = $OtherVoice
[void]$Voice.Speak($text)
$CurrentVoice = New-Object -ComObject SAPI.SPVoice
$Voices = $CurrentVoice.GetVoices()
foreach ($Voice in $Voices) {
if ($Voice.GetDescription() -notlike "*- German*") { continue }
$CurrentVoice.Voice = $Voice
[void]$CurrentVoice.Speak($text)
exit 0 # success
}
throw "No German text-to-speech voice found - please install one"

View File

@ -16,13 +16,12 @@ param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Italian text to speak" }
$Voice = New-Object -ComObject SAPI.SPVoice
$Voices = $Voice.GetVoices()
foreach ($OtherVoice in $Voices) {
$Description = $OtherVoice.GetDescription()
if ($Description -notlike "*- Italian*") { continue }
$Voice.Voice = $OtherVoice
[void]$Voice.Speak($text)
$CurrentVoice = New-Object -ComObject SAPI.SPVoice
$Voices = $CurrentVoice.GetVoices()
foreach ($Voice in $Voices) {
if ($Voice.GetDescription() -notlike "*- Italian*") { continue }
$CurrentVoice.Voice = $Voice
[void]$CurrentVoice.Speak($text)
exit 0 # success
}
throw "No Italian text-to-speech voice found - please install one"

View File

@ -16,13 +16,12 @@ param([string]$text = "")
try {
if ($text -eq "") { $text = read-host "Enter the Spanish text to speak" }
$Voice = New-Object -ComObject SAPI.SPVoice
$Voices = $Voice.GetVoices()
foreach ($OtherVoice in $Voices) {
$Description = $OtherVoice.GetDescription()
if ($Description -notlike "*- Spanish*") { continue }
$Voice.Voice = $OtherVoice
[void]$Voice.Speak($text)
$CurrentVoice = New-Object -ComObject SAPI.SPVoice
$Voices = $CurrentVoice.GetVoices()
foreach ($Voice in $Voices) {
if ($Voice.GetDescription() -notlike "*- Spanish*") { continue }
$CurrentVoice.Voice = $Voice
[void]$CurrentVoice.Speak($text)
exit 0 # success
}
throw "No Spanish text-to-speech voice found - please install one"