This function I made from a snippet from another user who made a chatbot that could speak its messages using Google Translator.
What I did was only getting the TTS part and turn it into a function ready to be used in any program as you wish.
No credits for me, if you want to credit someone credit the guy who made the original, whose name I don't know (the snippet is somewhere at this forums).
do
input string$
tts(string$)
loop
function tts(string$)
translateurl$="http://translate.google.com/translate_tts?ie=utf-8&tl=en&q=" + string$
filenumber$="tts.mp3"
if file exist(filenumber$) then delete file filenumber$
load dll "urlmon",1
a=CALL DLL(1,"URLDownloadToFileA",0,translateurl$,filenumber$,0,0)
delete dll 1
if file exist("tts.mp3")=1
LOAD music "tts.mp3",1
play music 1
While music playing(1)=1
endwhile
delete music 1
endif
endfunction