In terminal you can write something like:
say 'hello world'
Which will make your computer talk. To save the audio output to a file, use the -o option. A full example is:
say -o hello.aiff -v 'Alex' 'Hello, my name is Alex' open hello.aiff
This will say 'Hello, my name is Alex', in the voice of 'Alex' (other voice-options are 'Bruce', 'Fred, 'Kathy', 'Vicki' and 'Victoria'), and save the output to 'hello.aiff'.
It seems there is no option for setting the speed (can be set in System preferences -> speech). See man say for all options. Interesting options include sending the output over the network.