Rants of a madman » Text to speech - Command line save to wav - Whats missing in TextAloud
Jul
16

Presenting “sapi2wav”. (name choosen because text2wav was already taken)

Its a simple windows tool that allows you to do Text-To-Speech on command line.

The program will play a text given as argument or read a file and output to a wave file. It also allows you to choose other voices, if eg. you have NeoSpeech voices or AT&T Natural voices.

Its free (unlike any other commandline SAPI program ive found) and its Open Source (GPL).

Commandline processing is a MUST for any form of scripting or automation. I wanted to automaticly transfer daily news-stories to and MP3 player and now i can :)
Usage is as simple as:

sapi2wav.exe c:\out.wav 1 -t “Hello world”

TextAloud has a commandline mode, but its very oddly written, pretty beta and doesnt run under Linux. I wrote to Text Aloud (or NextUp.com) explaining my very insignificant problem and of course they didnt reply. So instead of buying their product, i ended up making an open source alternative :).

So if you install SAPI5 under wine (must be installed in windows ME compatability mode), then you can run this tool under wine as well and do commandline magic :)

Downloads:

Setting up MS-SAPI5 under wine should be as easy as configuring your wine to run in Windows ME mode, then download and run MS’s Sapi5 installer (msi - the Win ME version)

Winehq has an article on how to do this.

The tool SayPad from this page should have sapi5 included in the 95/98/me installer.. Though i havent testet it, i guess if you can install SayPad under wine, youll get the needed api’s.

please send me any changes you might make to this sapi to wav tool.



  - Dan

Comments

  1. Markus Said,

    this sir, is exactly what I’m after…. cheers for that

  2. copycat Said,

    do you have, or know of, a version for sapi4? i like those voices better, and have a specific application for which sapi4 is more suitable. please shoot me an email, even if the answer is no, so i ‘ll know. thanks,
    –copycat

  3. Dan Said,

    It shouldnt make a difference whether you have SAPI4 or 5 installed. Although i havent tested SAPI4 myself, i dont see why this tool shouldnt work with it.
    Give it a try and let me know the result :)

  4. David Eaton Said,

    Dan,

    Any way to change the default output settings? I was looking for:
    128kps
    16 bit
    1 channel (Mono)
    8 kHz sample rate
    PCM

    Keep in touch, David

  5. Dan Said,

    Sorry for the late reply.
    Currently there is no way to change the output setting without changing inside the source code.
    I may add options for these at some point, but i don’t have time currently.
    So either you must change the sourcecode or convert wave-file manually using another tool.

  6. Nuno Baptista Said,

    Hello,
    i’ve been using this software for quite some time. Thanks a lot.
    I was now wondering if it would be possible to make it work directly to standard output, in order to be able to redirect it to a named pipe, so that one could execute it faster.

    Thanks alot.
    Best Regards

  7. The First One Said,

    This is the only decent one for me. I discarded all the others (tested, command-line capable, etc.).
    I use AT&T’s voices. Everything from the computer can be told to me throught Sapi2wav, with different voices. My Pentium died. So, no more Windows XP. With a new computer, Sapi2Wav gives me the message: “Floating point division by zero”, when run under Windows 7.
    Can you help?

  8. Dan Said,

    sorry. i dont have windows or delphi anymore. but im told that windows 7 has a “run in compatability mode” option, to make windows run the program as if it was running on XP. you could give that a try. i cant tell you how to do it, as i dont know windows 7 at all.

  9. loafus Said,

    I love this. NO UI GARBAGE. Runs nicely from the command line.

    I thank you, Sir.

  10. Jason Said,

    Why is the sound quality so much inferior to TextAloud?

  11. Dan Said,

    Jason> It shouldnt be.. As both this program and TextAloud generate the sound through the Microsoft Speech API, it should be exactly the same.
    Perhaps youre not using exactly the same “voice” in both programs?

  12. edward Said,

    i’ve developed a test program based on sapi 51. It works perfectly on xp, both ide and withoute ide,but fails to do so out of the ide on windows 7. Error is floating point division by error. plz advise.

  13. Dan Said,

    @edward: Sorry, i have no idea why that would happen..

Add A Comment

REFRESH THIS PAGE TO POST COMMENTS!