I have seen the text-to-speech function floating around and I have used it for kicks... but now I want to use it to create a tutorial for my son to teach him a little bit about Darkbasic Pro to get him started.. The voice only speaks one thing and never speaks again until I restart the program!!! I can't really complete the tutorial without it!! Anyone have any ideas?
sync on: sync rate 0
type studentdata
NAME as String
EXPERIENCE as Integer
QUESTIONTIME as Integer
MADE as Integer
ATTEMPTS as Integer
QUIZSCORE as Integer
TESTSCORE as Integer
endtype
global DIM Student(60) as studentdata
maximize window
while scancode()<1
cls
Intro("Make sure your volume is up",4000)
Intro("This is a voice activated tutorial",4000)
Intro("Please make sure your speakers are working",4000)
Intro("Press any key to continue",4000)
sync
endwhile
tts("Hello... Welcome to the DarkBasic Pro Tutorial"): sleep 375
tts("Type in your name and we can get started..") : sleep 375
set cursor 320,200
input studentname$
end
function Intro(s$,waittime)
t=0
do
cls
inc t,1
center text 320,200,s$
if scancode()>0 or t>waittime then exit
sync
loop
endfunction
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
- Infinity is Simplicity -