say.js icon indicating copy to clipboard operation
say.js copied to clipboard

Windows: Audio file export

Open TotallyInformation opened this issue 9 years ago • 6 comments

Hi, as you are calling out to PowerShell and using the system speach synth, there are some really easy wins.

For example, there is no reason why you couldn't implement the export function as this is easily done.

Please see the following article on how to do this: https://learn-powershell.net/2013/12/04/give-powershell-a-voice-using-the-speechsynthesizer-class/

commands = [ 'Add-Type -AssemblyName System.speech; $speak = New-Object System.Speech.Synthesis.SpeechSynthesizer; $speak.Speak([Console]::In.ReadToEnd())' ];

changing to:

commands = [ 'Add-Type -AssemblyName System.speech; $speak = New-Object System.Speech.Synthesis.SpeechSynthesizer; $speak.rate( = -5; $speak.Speak([Console]::In.ReadToEnd())' ];

will slow down the output speech for example. Speeds are absolute from -10 to +10.

You could also change to async output by replacing $speak.Speak with $speak.SpeakAsync

More examples at: http://www.adminarsenal.com/admin-arsenal-blog/powershell-text-to-speech-examples/

TotallyInformation avatar Dec 21 '16 17:12 TotallyInformation

Can you write a PR for this and confirm that it works on Windows?

tlhunter avatar Dec 25 '16 06:12 tlhunter

Bit short on time right now but I'll see what I can do.

TotallyInformation avatar Jan 06 '17 17:01 TotallyInformation

Speed is already handled in #46, but the async output is nice.

jimbuck avatar Oct 30 '17 12:10 jimbuck

Speed and Voice are now fully implemented by #67 and #68!

jimbuck avatar Nov 05 '17 23:11 jimbuck

Repurposing this issue just to track Windows export support.

According to the linked article this can be done via:

$speak.SetOutputToWaveFile("C:\users\Administrator\Desktop\test.wav")
$speak.Speak("Would you like to play a game?")
$speak.Dispose()

tlhunter avatar Nov 06 '17 00:11 tlhunter

I might be able to give it a shot this week!

jimbuck avatar Nov 06 '17 01:11 jimbuck