Update the speak-*.ps1 scripts

This commit is contained in:
Markus Fleschutz 2022-09-28 10:03:04 +02:00
parent 4f31313923
commit ea92d28485
16 changed files with 65 additions and 65 deletions

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Arabic text to speak" } if ($text -eq "") { $text = read-host "Enter the Arabic text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Arabic*") { if ($Voice.GetDescription() -like "*- Arabic*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Danish text to speak" } if ($text -eq "") { $text = read-host "Enter the Danish text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Danish*") { if ($Voice.GetDescription() -like "*- Danish*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ("$text" -eq "") { $text = read-host "Enter the English text to speak" } if ("$text" -eq "") { $text = read-host "Enter the English text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- English*") { if ($Voice.GetDescription() -like "*- English*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the French text to speak" } if ($text -eq "") { $text = read-host "Enter the French text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- French*") { if ($Voice.GetDescription() -like "*- French*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the German text to speak" } if ($text -eq "") { $text = read-host "Enter the German text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- German*") { if ($Voice.GetDescription() -like "*- German*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Greek text to speak" } if ($text -eq "") { $text = read-host "Enter the Greek text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Greek*") { if ($Voice.GetDescription() -like "*- Greek*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Hindi text to speak" } if ($text -eq "") { $text = read-host "Enter the Hindi text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Hindi*") { if ($Voice.GetDescription() -like "*- Hindi*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Italian text to speak" } if ($text -eq "") { $text = read-host "Enter the Italian text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Italian*") { if ($Voice.GetDescription() -like "*- Italian*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Japanese text to speak" } if ($text -eq "") { $text = read-host "Enter the Japanese text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Japanese*") { if ($Voice.GetDescription() -like "*- Japanese*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -1,6 +1,6 @@
<# <#
.SYNOPSIS .SYNOPSIS
Speaks text with a Latin text-to-speech voice Speaks text in Latin
.DESCRIPTION .DESCRIPTION
This PowerShell script speaks the given text with a Latin text-to-speech (TTS) voice. This PowerShell script speaks the given text with a Latin text-to-speech (TTS) voice.
.PARAMETER text .PARAMETER text
@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Latin text to speak" } if ($text -eq "") { $text = read-host "Enter the Latin text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Latin*") { if ($Voice.GetDescription() -like "*- Latin*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Mandarin text to speak" } if ($text -eq "") { $text = read-host "Enter the Mandarin text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Mandarin*") { if ($Voice.GetDescription() -like "*- Mandarin*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Polish text to speak" } if ($text -eq "") { $text = read-host "Enter the Polish text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Polish*") { if ($Voice.GetDescription() -like "*- Polish*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Portuguese text to speak" } if ($text -eq "") { $text = read-host "Enter the Portuguese text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Portuguese*") { if ($Voice.GetDescription() -like "*- Portuguese*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Spanish text to speak" } if ($text -eq "") { $text = read-host "Enter the Spanish text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Spanish*") { if ($Voice.GetDescription() -like "*- Spanish*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Swedish text to speak" } if ($text -eq "") { $text = read-host "Enter the Swedish text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Swedish*") { if ($Voice.GetDescription() -like "*- Swedish*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Ukrainian text to speak" } if ($text -eq "") { $text = read-host "Enter the Ukrainian text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Ukrainian*") { if ($Voice.GetDescription() -like "*- Ukrainian*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }