text to speach can be done using espeak.
echo "test" | espeak --stdin -w test.wav
--or--
espeak -f test.txt