Thank for the nice comments!
* yes it is an easy change, to save the file and use the sound offline. You could store during development all talk-files in directory (a.e. sounds/) and in the final version change the say to simply play the already existing files.
just pass a filename to the function
a.e.
function say(in_lang$,In_text$,In_filename$)
`-------------------------------------------------------------------
` called with language and text the function will produce and play
` a mp3 containing the text
`
` Example: say("en","hello+world","jane_say_hello.mp3")
`
` language: a 2-letter language-code as used by your browser to
` indentify the language (a.e. en,fr,de,it...)
` text: s string containing the text to speak
` blank should be replaced by +-signs
`-------------------------------------------------------------------
url$="http://translate.google.com/translate_tts?tl="+in_lang$+"&q="+in_text$
if not file exist(FileName$)
load dll "urlmon",1
a=CALL DLL(1,"URLDownloadToFileA",0,url$,In_Filename$,0,0)
delete dll 1
endif
load music In_FileName$,1
play music 1
while music playing(1)
sync
endwhile
delete music 1
endfunction
As you can see, in this variant the soundfile is only generated if it does not (yet) exist. Thus minimizing traffic and keeping the files on your disk for later use.
But the previous Version of the program is usefull if you want to dynamically create a spoken sound (a.e. Now you've got five hits and your enemy is behind your back to the left... or at your seven). And by the way google-tranlate is still working, while they shut down some services lately.
* And Yes, I would like to select male/female voice at least. But google does not offer to do so, or I did not find the switch.