Advertisement
jessemoore

Text2Speech

Sep 12th, 2020 (edited)
1,993
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Text2Speech
  2. Add-Type -AssemblyName System.speech
  3. $tts = New-Object System.Speech.Synthesis.SpeechSynthesizer
  4.  
  5. # Importing from text file
  6. #$PhraseLocation = "C:\ListOfPhrases.csv"
  7. #$Phrase         = (Get-Content $PhraseLocation) | Get-Random
  8.  
  9. # Using an array
  10. $Phrase2 = @("I am a robot","Help, I'm stuck in the computer!","What are you doing, $env:USERNAME")
  11.  
  12. $tts.Rate   = 0  # -10 is slowest, 10 is fastest
  13. $tts.Speak($Phrase2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement