Skip to content

Instantly share code, notes, and snippets.

@Y-Koji
Created June 8, 2019 13:34
Show Gist options
  • Save Y-Koji/cf1e518996934cfafbba1a09c699bf94 to your computer and use it in GitHub Desktop.
Save Y-Koji/cf1e518996934cfafbba1a09c699bf94 to your computer and use it in GitHub Desktop.
function Speak-Text {
param($text)
Add-Type -AssemblyName System.Speech
$ss = New-Object System.Speech.Synthesis.SpeechSynthesizer
$ss.Volume = 100
$ss.SelectVoiceByHints(
[System.Speech.Synthesis.VoiceGender]::Female,
[System.Speech.Synthesis.VoiceAge]::Adult)
$ss.SetOutputToDefaultAudioDevice()
$ss.Speak($text)
$ss.Dispose()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment