diff --git a/Scripts/speak-test.ps1 b/Scripts/speak-test.ps1 index 9d0d68ac..9a886edf 100755 --- a/Scripts/speak-test.ps1 +++ b/Scripts/speak-test.ps1 @@ -6,40 +6,48 @@ .NOTES Author: Markus Fleschutz / License: CC0 #> +function Speak { param([string]$Text) + write-output "'$Text'" + $Result = $Voice.speak("$Text") +} + try { $Voice = new-object -ComObject SAPI.SPVoice $DefaultVolume = $Voice.volume $DefaultRate = $Voice.rate - $Result = $Voice.Speak("This is the default voice with default volume $DefaultVolume and speed $DefaultRate") + Speak("This is the default voice with default volume $DefaultVolume and speed $DefaultRate") $Voice.rate = -10 - $Result = $Voice.Speak("Let's speak very, very slow") + Speak("Let's speak very, very slow") $Voice.rate = -5 - $Result = $Voice.Speak("Let's speak very slow") + Speak("Let's speak very slow") + $Voice.rate = -3 + Speak("Let's speak slow") + $Voice.rate = 0 + Speak("Let's speak normal") $Voice.rate = 2 - $Result = $Voice.Speak("Let's speak fast") + Speak("Let's speak fast") $Voice.rate = 5 - $Result = $Voice.Speak("Let's speak very fast") + Speak("Let's speak very fast") $Voice.rate = 10 - $Result = $Voice.Speak("Let's speak very, very fast") + Speak("Let's speak very, very fast") $Voice.rate = $DefaultRate $Voice.volume = 100 - $Result = $Voice.Speak("Let's try 100% volume") + Speak("Let's try 100% volume") $Voice.volume = 75 - $Result = $Voice.Speak("Let's try 75% volume") + Speak("Let's try 75% volume") $Voice.volume = 50 - $Result = $Voice.Speak("Let's try 50% volume") + Speak("Let's try 50% volume") $Voice.volume = 25 - $Result = $Voice.Speak("Let's try 25% volume") + Speak("Let's try 25% volume") $Voice.volume = $DefaultVolume $Voices = $Voice.GetVoices() foreach ($OtherVoice in $Voices) { - $Description = $OtherVoice.GetDescription() - write-output "Voice: $Description" $Voice.Voice = $OtherVoice - $Result = $Voice.Speak("Hello, I'm the voice called $Description") + $Description = $OtherVoice.GetDescription() + Speak("Hi, I'm the voice called $Description") } exit 0 } catch {