say command is perhaps OS X terminal's most compelling feature - it takes text as input and speaks it through the computer's speakers. Is there any equivalent command-line tool on Windows, either built-in or via a third-party program?
PTTS is a very simple Microsoft Windows command line program to convert text to speech. If uses the Microsoft Text to Speech Engine and the Microsoft Speech SDK. The Text to Speech Engine is installed with Windows XP with one voice of somewhat poor quality. The Jampal installation program includes two better sounding voices. (quoted from website)
One can use it by simply entering the text into the program by redirection or by piping in text:
ptts < file.txt echo Hello there|ptts
I've created a simple Batch Script for doing this. Here's the source code
@echo off echo Dim Speak >> %HOMEPATH%\speak.vbs echo Set Speak=CreateObject("sapi.spvoice") >> %HOMEPATH%\speak.vbs echo Speak.Speak "%*">> %HOMEPATH%\speak.vbs %HOMEPATH%\speak.vbs del %HOMEPATH%\speak.vbs
Save this script in a file called "speak.bat" and move it to a directory referenced by your PATH variable.
This program creates a simple vbs with your input, then speaks it with system voice. At the end of the execution, the script will be deleted to give space for another execution.
I got tired of trying to make outdated tools work, so I created
It works like
say, you can select different voices and you can easily output to a wave file.
They have this library in the SDK, where you could probably make a more advanced utility with some personal effort.
Although this is probably the most convenient way as it is natively built into the system, and is accessible via powershell.
Call the function from the namespace (https://msdn.microsoft.com/en-us/library/gg145021(v=vs.110).aspx)
Add-Type -AssemblyName System.Speech
Instantiate the Object
$synth = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer
Call the function and input your words as it's argument.