Skip to content

Instantly share code, notes, and snippets.

@StartAutomating
Created February 25, 2025 00:36
Show Gist options
  • Save StartAutomating/3e0d1e069cf06606ab9295fdef7d30d8 to your computer and use it in GitHub Desktop.
Save StartAutomating/3e0d1e069cf06606ab9295fdef7d30d8 to your computer and use it in GitHub Desktop.
Gist a bit of Text to Speech in PowerShell
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