View Single Post
Old 11-06-08, 09:27 PM   #119
panthercules
The Old Man
 
Join Date: Apr 2005
Posts: 1,336
Downloads: 6
Uploads: 0
Default

Quote:
Originally Posted by minsc_tdp
Quote:
Originally Posted by panthercules
Without really knowing much about the way SH4/SH3Speech is programmed, it seems to me that it should be possible in theory to separate the part of the program that recognizes the sounds from the part of the program that acts upon what has been recognized. Therefore, I'm just wondering if there wouldn't be some way to combine the front-end speech recognition aspects of Shoot with the back-end recognized command output capabilities of SH4/SH3Speech, and thereby come up with a really great voice command program for use with SH3 when played in German.
This would actually be pretty easy. In fact, I could show you how right now because I'm feeling saucy.

To do this only requires that you download perl2exe and can recompile source\voice.pl into dist\voice.exe.

Voice.pl has this line (250):

my $phrase = $_;

This line sets $phrase to equal whatever the python listener script returned. So you could just overwrite it with an extra line below, using something supplied on the command line:

$phrase = $ARGV[5];

Now if you look at your BAT launch files, you'll notice they use:

voice 1024x768 stock 1 right sh4

so $ARGV[5] would expect that you hardcode a phrase on the launch command, like this:

voice 1024x768 stock 1 right sh4 "Fire"

(Note that you may need to remove the quotes from $phrase. Try an additional line of $phrase =~ s/"//g; if necessary.)

Now, every time you run that line, it will start up, issue the Fire command to the game. Now you want it to exit immediately. So find this line (688):

# Must be at the end of the main loop

add this line below it:

last();

Below that you'll see another line:

print "Restarting speech engine...\n";

Put another last(); line *above* that. So this ought to cause it to exit cleanly.

That's it. You're done. Recompile your modified source\voice.pl into dist\voice.exe. Test the changes by running:

voice 1024x768 stock 1 right sh4 "Fire"

and ensuring that it launches, issues the command, and exits, and will repeatedly do so.

Now you just have to program Shoot to launch shSpeech like this:

voice 1024x768 stock 1 right sh4 "whatever phrase Shoot just recognized"

and of course have Shoot pass the appropriate command. shSpeech should dutifully process each phrase and then gracefully exit. Some additional performance improvements would be strongly recommended, like figuring out how to remove line 246:

open(PHRASEIN, "hear \"$ARGV[1]\" |") || die $!;

which is the command that launches the MS SAPI based python listener, which would add a tremendous level of overhead.

I hope this was informative. If the bleating is loud enough, I could do these changes myself and release an update that has this additional "one-off" mode.
BLEAT BLEAT BLEAT !!!!

Hey man - great to "see" you again - as you know I'm a huge fan and really appreciate the help you gave me way back in SH4 days to help tailor the SH4 version of this to my taste.

Most of what you said is completely "Greek" to me, unfortunately. I think you detailed a way to have Shoot recognize the German language command I've spoken and then, instead of outputting the key-press that SH3 expects as it normally would, Shoot would instead somehow cause SH3Speech to start up, issue the desired command to SH3, and then close itself. Seems like a lot of steps to go through, but if SH4Speech can load and quit quickly enough it sounds like it should work.

Now, just got to figure out whether there's any way in the world I'll be able to figure out how to do this - I think you lost me at "To do this only requires that you download perl2exe and can recompile source\voice.pl into dist\voice.exe.", as I have no idea how I would recompile anything (the downloading part I could probably handle )

So, maybe back to my fall-back strategy: BLEAT BLEAT BLEAT !!!!
__________________
panthercules is offline   Reply With Quote