Speech in Powershell – Continue
In my previous post i had shown, how to save the text in an audio format and then listen.
But if we just need to listen without saving the audio, then it is much simpler and very easy. So here i have written the script to convert the text to audio without saving it to a file.
Have a text file with “poem.txt” in the D drive and then run this code, and remember to keep your speakers on.
$speechObj = New-Object -ComObject SAPI.SpVoice
$fileName = "D:\poem.txt"; #Enter the file that has to be converted to an audio file
$data = Get-Content $fileName
Try running this code and again keep your speakers on:)