23
6
The 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?
23
6
The 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?
5
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
@bubu, it looks like this software is only capable of speaking from a file, unless I'm misunderstanding the documentation. Do you know if there's any way for it to accept text directly from the command line without needing to create an intermediary file? – nhinkle – 2010-12-20T05:10:35.623
2Nvm, figured it out. You have to pipe it to the program. E.g. echo Hello|ptts.exe
. I would prefer a way to have the text be an argument of the command, but this will suffice if there's no way to do that. – nhinkle – 2010-12-20T05:11:56.450
@nhinkle yes as it reads from stdin one of the way is to pipe through it – bubu – 2010-12-20T05:26:19.853
3
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.
Can you please edit your post to explain how this works and how to use it? Also, what purpose does moving the file have for this solution? – Cfinley – 2015-03-03T19:47:50.713
@Cfinley : Post edited – Alessandro Mascolo – 2015-03-04T19:08:19.340
2
This question was asked on Stack Overflow. I like the answer with the VBS script.
Also, espeak
is available for Windows and Linux and has been ported to OS X. I don't believe it uses the built-in Windows TTS engine.
1
They have this library in the SDK, where you could probably make a more advanced utility with some personal effort.
https://www.microsoft.com/en-us/download/details.aspx?id=27224
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.
$synth.Speak('hey man')
0
I got tired of trying to make outdated tools work, so I created wsay
.
It works like say
, you can select different voices and you can easily output to a wave file.
https://github.com/p-groarke/wsay/releases
Cheers
7Just make sure your speaker volume is turned up. – Daniel Beck – 2010-12-20T07:05:16.497
2Which gets me thinking, maybe I should write a command-line volume changing application, in case the situation should ever arise. – nhinkle – 2010-12-20T07:17:05.053