Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / tts is limited???

Author
Message
DARKBASIC PRO 3d WORLD EDITOR
13
Years of Service
User Offline
Joined: 2nd May 2012
Location:
Posted: 24th Mar 2015 04:23
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 -
Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 24th Mar 2015 07:16 Edited at: 24th Mar 2015 07:24
You are only taking a single input then declaring end. You are also not appearently doing anything with that input.

You need to pass studentname$ to the tts function, and place the input command and call to tts into a loop to take input over and over again.

Something like this



DARKBASIC PRO 3d WORLD EDITOR
13
Years of Service
User Offline
Joined: 2nd May 2012
Location:
Posted: 24th Mar 2015 11:55
Quote: "You are only taking a single input then declaring end. You are also not appearently doing anything with that input.

You need to pass studentname$ to the tts function, and place the input command and call to tts into a loop to take input over and over again.
"


Well I wanted it to speak the first 2 statements and then get the user's input so I kind of stopped when it didn't do what I wanted! I changed it to a do..loop just to see if it worked but it didn't.. but what I did notice was when it did the tts function the second time, it got caught up and seems to never leave the function!!



I even tried different versions of DBPro as well... I can not crack this!!!

- Infinity is Simplicity -

Login to post a reply

Server time is: 2025-05-12 15:32:58
Your offset time is: 2025-05-12 15:32:58