mwsynth - Network speech synthesis

Author: Rupert Scammell (
Current version: 2.0 / 2001-09-07
License: GNU General Public License

mwsynth provides an interactive shell and command line interface that allows the rough synthesis of input text, by taking advantage of the online pronounciation features of the Merriam-Webster Online Dictionary.

A few points are worth noting. This application is intended as an experiment and a toy. It's not for serious use, i.e, don't attempt to feed the program the entire etext of the Hitchhikers Guide to the Galaxy, and come back three days later. The program will do it, yes, but it'll eat up quite a bit of time and bandwidth on MW's servers in the process. Be a responsible network citizen.

To use the interactive shell, simply invoke the program with python If this is the first time you're running the program, you'll need to set a couple of system specific configuration options at the top of the file, then run the program. If you'd prefer not to use the shell, you can pass a text file to be synthesized as the first command line argument, e.g. python charge_of_the_goddess.txt.

mwsynth's interactive shell options:
	any text           : synthesized and put in playlist.
	!quit                : exits program.
	!help                : prints this help screen.
	!file                : filename synthesizes text from file.
	!voice m|f|n	     : Voice gender. m=male, f=female, n=mixed
	!speak string        : speaks the string (no quotes, spaces allowed).
	!speak_file filename : speaks the text in file filename.
	!debug on|off        : turns on and off debug output.
	!speak_playlist      : Speaks the current contents of the playlist.
	!word_interval s     : changes pause interval (in secs) between words.
	!rplaylist on|off    : if on, playlist is cleared for each output.
	!clear_playlist      : clears whatever is currently in the playlist.
After mwsynth finishes synthesizing speech, you'll be left with a playlist file, and a series of numbered .WAV format files in a directory. Feeding the playlist file to media player such as XMMS will result in the synthesized speech being played back. If you're in the interactive shell, and have a WAV file player correctly mapped in the configuration options, synthesized speech will be spoken automatically.

Quirks and things to watch out for:
Currently, the program takes the first available pronounciation seen in the page returned by the dictionary. This often results in the infinitive form of verbs being subsituted in synthesized speech. For instance, the phrase "Where is it?" will be synthesized as "Where be it?".

There is no word caching. If you type "the the the", the program will individually make the same request for the word "the", three times.

If a word is unrecognized, it's simply not retrieved, and we go onto the next word. Consequently, the synthesized speech will be played with the word missing.

Punctuation of almost any kind is ok. It just gets stripped before synthesis.

There is no Unicode/Internationalization support. The dictionary supports US/British English only.

Other resources
As mentioned above, anyone doing anything remotely serious with speech synthesis should be using another application. Other good speech synth resources include:

The Festival Speech Synthesis System - Free, open source C++/Scheme speech synth from the University of Endinburgh.
AT&T Labs Natural Voices - High quality commercial text to speech engine from AT&T Research.