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.

Code Snippets / [DBP] - Let your program talk

Author
Message
Attila
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 27th May 2011 13:21 Edited at: 27th May 2011 13:24
This a simple to use function to add speaking to a DBP-Program it is called with language and text the function will produce and play a mp3 containing the text. It uses the google translation service to provide the right pronunciation depending on the language choosen in the first parameter. Therefore it will need a working internet-connection while running.

Example: say("en","hello+world")

language: a 2-letter language-code as used by your browser to
indentify the language (a.e. en,fr,de,it,es,ru...)

text: s string containing the text to speak
blank should be replaced by +-signs


sheffieldlad
12
Years of Service
User Offline
Joined: 28th May 2011
Location:
Posted: 30th May 2011 23:17
That's great.
A better idea would be to incorporate SAPI5 support in an app/game.
I use SAPI5 generated mp3s in my first little game I coded.
I use over 20 of them so it makes the finished package rather large.
Your little app goes part of the way to eliminating this, well done
Attila
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 7th Jun 2011 13:44
@sheffieldlad

how do you do this?
Dances With Robots
13
Years of Service
User Offline
Joined: 13th Jan 2011
Location:
Posted: 8th Jun 2011 01:43
Umm. . .hate to be the wet blanket, but Google has recently announced that their translate API has been deprecated and will be gone in December.

Sorry.
SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 23rd Jul 2011 23:03
@Dances With Robots
NOOOOOO!! I love google translate

gwheycs62egydws
14
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 9th Aug 2011 09:01 Edited at: 9th Apr 2013 02:40
it seams the good things must go

it would have been nice if other voices
could have been picked

this company give windows more voices

https://www.cepstral.com/

it will cost ya though

there is the pay version of the voice add on for DBP
and there is free version that some one made

to move side ways - is to move forward
Since a Strait line gets thin fast
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 14th Aug 2011 05:43 Edited at: 14th Aug 2011 05:55
Firstly, that is a cool bit of code. I always loved playing around with the voice software built into the amiga, so this is a blast from the past! Secondly, that is real bad news that google are shutting it down. Google translate, although I don't need to use as such, is a really good idea, and I am sure some people use it a lot.
10/10 for that snippet Attila!
say("en","baaah. escrumish. venthipljash!") gives vaguely sims type sound effects lol. Changing the language only adds to the effect

http://s6.bitefight.org/c.php?uid=103081
gwheycs62egydws
14
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 14th Aug 2011 07:21
with a bit of tweaking
the code could be set to save the file and wile
the option still exists voice files could be created
for later use and I know there is at-least one program
that lets some one change the sound file
so other voices could be created

If a thought is Just a thought ~ so whats the main thought ?
Attila
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 24th Oct 2011 17:27 Edited at: 24th Oct 2011 18:02
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.



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.

Login to post a reply

Server time is: 2024-04-19 15:25:46
Your offset time is: 2024-04-19 15:25:46