Text to speech from blender game engine

Hi,

Good news!!
I have gotten the open source TTS program Espeak working from blender. My blender game engine can talk to me :smiley:

Bad news :
The only problem is that when it loads the command line version of Espeak the game engine freezes until it is done reading the script.

Here is how I have it set up, I have this script wired to a keypress sensor:

import os
os.system("espeak -f scriptname.txt")

Is there some way to just tell blender to send off that command, and not wait until the reading is complete to continue with the game?

here is my test file :
http://www.savefile.com/files/1160752

Here is a link to Espeak, you will need this installed for espeak to function properly.
http://espeak.sourceforge.net/

This would be awesome to get running smooth with blender.
Just think!, rather than having hundreds of megabytes of speech sound files for an RPG game, you could have just simple text scripts for the TTS system to recite for the NPC’s dialogs, and for narrating parts of the story .

Thanks in advanced for any help :smiley:

Can we use “subprocess.call()” in the BGE?
how about “subprocess.Popen()” ?

would those even help?

Ok !

I got os.startfile to work!!I think I can run with this now!
Verys special thanks to Wert613 from the blenderchat IRC :smiley:

Problem is that I can only get it to see a batch file, or a shortcut for some reason ,not the exe file :confused:

good news is that with a batch file, I can use the CMD shell window for nice text, without having to pack a bitmap font with my game :smiley:

I will have a full tutorial as soon as I get a proto type ready!

pleas , if anyone can get the speach running from the EXE file, please post how you did it here :slight_smile:

  • Try not to double/triple…etc post. If you forget to write down something important, use the edit functionality - that’s why it’s there.
  • Wrong forum. This belong in Demos/WIP.
  • “Popen” is a subprocess class used to open “two-way” pipes between two programs -> so you can pass standard input from one program to the other, and receive standard output back from the other without having to relaunch the external app in question. So, let’s say that you have an mp3 player on your PC that can take shell commands - you can use Popen to manipulate not only what mp3 file to play, but also how loud, faded, balanced the sound will be at any given time. All interactively.Heh, it’s really not anything all that new, but it is probable that most people don’t know about the fact that they can use almost any program from the BGE.

So in that respect it’s useful information, if nothing else.

Good job.

I have already posted solution in the other thread http://blenderartists.org/forum/showthread.php?t=108695

Very interesting Mmph!
I will try this… I have always wondered if it might be posible to use one of the chatbots like http://www.jabberwacky.com/ to speak to you in conversation through the BGE…there’s some opensource ones you can customise like Alice… but I’m not that clever.
and its probably the wrong forum :frowning:

Hi guys!

Thanks for the commentary Social, it was very useful :smiley:

Thanks ashsid! I tried your method in the other thread, I dont think the game engine allows, or knows about the os.spawnl command.

hey larry boy! thanks for the info about Alice, I will check that out and see if I can get that working.

Actually Alice was a bit boring when I tried it about a year and a half ago. but it is OS and it may have got better… Really liked Jabberwacky but you have to pay if you want to customise…