mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-16 18:06:45 +02:00
Add speak-danish.ps1 and speak-polish.ps1
This commit is contained in:
parent
3264c2fbed
commit
485bcbfe65
33
Scripts/speak-danish.ps1
Normal file
33
Scripts/speak-danish.ps1
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Speaks text with a Danish text-to-speech voice
|
||||||
|
.DESCRIPTION
|
||||||
|
This PowerShell script speaks the given text with a Danish text-to-speech (TTS) voice.
|
||||||
|
.PARAMETER text
|
||||||
|
Specifies the text to speak
|
||||||
|
.EXAMPLE
|
||||||
|
PS> ./speak-danish Hej
|
||||||
|
.LINK
|
||||||
|
https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES
|
||||||
|
Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param([string]$text = "")
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($text -eq "") { $text = read-host "Enter the Danish text to speak" }
|
||||||
|
|
||||||
|
$TTSVoice = New-Object -ComObject SAPI.SPVoice
|
||||||
|
foreach ($Voice in $TTSVoice.GetVoices()) {
|
||||||
|
if ($Voice.GetDescription() -like "*- Danish*") {
|
||||||
|
$TTSVoice.Voice = $Voice
|
||||||
|
[void]$TTSVoice.Speak($text)
|
||||||
|
exit 0 # success
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw "No Danish text-to-speech voice found - please install one"
|
||||||
|
} catch {
|
||||||
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
exit 1
|
||||||
|
}
|
33
Scripts/speak-polish.ps1
Normal file
33
Scripts/speak-polish.ps1
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Speaks text with a Polish text-to-speech voice
|
||||||
|
.DESCRIPTION
|
||||||
|
This PowerShell script speaks the given text with a Polish text-to-speech (TTS) voice.
|
||||||
|
.PARAMETER text
|
||||||
|
Specifies the text to speak
|
||||||
|
.EXAMPLE
|
||||||
|
PS> ./speak-polish cześć
|
||||||
|
.LINK
|
||||||
|
https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES
|
||||||
|
Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param([string]$text = "")
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($text -eq "") { $text = read-host "Enter the Polish text to speak" }
|
||||||
|
|
||||||
|
$TTSVoice = New-Object -ComObject SAPI.SPVoice
|
||||||
|
foreach ($Voice in $TTSVoice.GetVoices()) {
|
||||||
|
if ($Voice.GetDescription() -like "*- Polish*") {
|
||||||
|
$TTSVoice.Voice = $Voice
|
||||||
|
[void]$TTSVoice.Speak($text)
|
||||||
|
exit 0 # success
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw "No Polish text-to-speech voice found - please install one"
|
||||||
|
} catch {
|
||||||
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
exit 1
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user