Mac OS X provides say command in its Terminal Utility to perform Text-To-Speech.
Just type: say “Hello World”, it will speak out.
To output this sound into a Wave file, you can provide file name, it will infer the file extension on file name, and you provide the data format, just type:
say -o hi.wav –data-format=LEF32@8000 “Hello World”