Created
February 25, 2025 00:36
-
-
Save StartAutomating/3e0d1e069cf06606ab9295fdef7d30d8 to your computer and use it in GitHub Desktop.
Gist a bit of Text to Speech in PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[string] | |
$Message = "Coming at you live from the uncanny valley" | |
) | |
if ($IsUnix -or $IsMacOS) { | |
throw "SAPI not available on Unix/MacOS" | |
} | |
Start-ThreadJob -ScriptBlock { | |
$sapi = New-Object -ComObject Sapi.SpVoice | |
$sapi.Speak("$args") | |
} -ArgumentList $Message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment