SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH4 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 08-03-07, 11:31 PM   #31
minsc_tdp
XO
 
Join Date: Mar 2007
Posts: 411
Downloads: 1
Uploads: 0
Default

Quote:
Originally Posted by moselgott
the hear.py window opens only for less than a second and immediately closes again. Nothing happens further on

EDIT: Ok, I made that window run entering "hear.py" instead of "sh4speech.bat". So that window appears with the sentence "listening for phrases from voice_commands.csv", and commands like "map" or "dive" appear there if I speek into the microphone. So I started SH4 parallel to that window and gave several commands, but nothing happened. I went back to desktop and the window showed up with all the commands I gave while Sh ran. What do I do wrong!?!?!?
Any ideas?
Usually just running this stuff from a command prompt instead of double-clicking the BAT will help a lot. Or just edit sh4speech.bat and add a pause to the end of the file.

sh4speech.bat just runs go.pl, which tries to invoke the popup of hear.py. Sounds like the invocation of that failed, but you got hear.py to run on your own, which is just as good. If it said "Listening for voice commands..." then hear.py is working fine, and the question is, is go.pl running? Sounds like no, and probably since it failed, it brought down hear.py with it. It shouldn't but I suppose if it crashed quickly enough it could.

Question is, why isn't go.pl running? Open a command prompt, go do the command "cd \sh4speech" and then type "perl go.pl" (without all the quotes of course.) You'll probably see an error, paste that here and we can make some progress.

It's hard for me to get on the internet here, but when I return I'll write a nice test script that probes all of the various things, like a troubleshooter, which should help make all this easier.
__________________
June 29 2016 - shSpeech v2.55 - Voice Command for Silent Hunter 4! View Thread
minsc_tdp is offline   Reply With Quote
Old 08-04-07, 12:47 PM   #32
Fraggulus
Swabbie
 
Join Date: Jul 2007
Posts: 7
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by minsc_tdp
First, I haven't tested this in Vista at all but I see no reason it shouldn't work.

Second, [..]
Hi minsc_tdp,

thanks for your answer.
Instead of using the zip-files from your download-link (btw.: it seems the link isn't working any longer..) I downloaded the msi installation package of ActivePerl (http://www.activestate.com/store/dow...9-e1483f751c4f) and perl is working.

Now I got a similar problem like moselgott. The window of hear.py is closing after a second with following error message:

Code:
Traceback (most recent call last):
  File "hear.py", line 103, in <module>
    speechReco = SpeechRecognition(wordsToAdd)
  File "hear.py", line 33, in __init__
    self.context = self.listener.CreateRecoContext()
  File "C:\Users\User\AppData\Local\Temp\gen_py\2.5\C866CA3A-32F7-11D2-9602-00C0
4F8EE628x0x5x3.py", line 2638, in CreateRecoContext
    ret = self._oleobj_.InvokeTypes(10, LCID, 1, (9, 0), (),)
pywintypes.com_error: (-2147352567, 'Ausnahmefehler aufgetreten.', (0, None, None, None, 0, -2147467259), None)
But I think this error is based on the Win Vista and maybe the installed German language of Vista.

Possibly some other users successfully tested sh4speech on Vista??
Fraggulus is offline   Reply With Quote
Old 08-04-07, 02:44 PM   #33
moselgott
Watch
 
Join Date: Apr 2006
Posts: 23
Downloads: 0
Uploads: 0
Default

Hey you Guys, thanks for your help!

I managed to figure out the problem, or better to say I solved it without knowing what it was

Anyway, I removed everything and reinstalled each single programme, and voilà, everything works as it should now!

I was so amazed when I became aware about the possibilities, so I send you a bigger than big THANK YOU, PERFECTLY DONE!!!!!!!!!!!!

I´m just wondering what I have to do if I want to use this for IL-2...
__________________
"War does not determine who´s right, only who´s left" - Bertrand Russel
moselgott is offline   Reply With Quote
Old 08-04-07, 07:38 PM   #34
minsc_tdp
XO
 
Join Date: Mar 2007
Posts: 411
Downloads: 1
Uploads: 0
Default

Moselgott - There is absolutely nothing in the code that is specific to SH4. The only thing that makes it work in that game is the CSV files defining all of the commands. You could easily modify those files and make it work with any game. When it presses the keys, it just sends it to the keyboard so theoretically any game should respond to them. Go nuts!
__________________
June 29 2016 - shSpeech v2.55 - Voice Command for Silent Hunter 4! View Thread
minsc_tdp is offline   Reply With Quote
Old 08-04-07, 08:00 PM   #35
minsc_tdp
XO
 
Join Date: Mar 2007
Posts: 411
Downloads: 1
Uploads: 0
Default

Fraggulus - the only thing I could possibly recommend there is to make sure to install Microsoft SAPI 5.1 SDK for Windows Vista, if such a thing exists. I know that Vista includes a new version of the speech engine, version 6.0+, and it's possible that hear.py is trying to hook into 5.1 which simply isn't there. It might work to just install it, who knows. I have Vista installed at home so I'll try to get it working there when I return. Possibly, some minor changes need to be made to hear.py to get it to just use the newer Vista speech engine instead of being stuck on 5.1.
__________________
June 29 2016 - shSpeech v2.55 - Voice Command for Silent Hunter 4! View Thread
minsc_tdp is offline   Reply With Quote
Old 08-06-07, 11:08 AM   #36
moselgott
Watch
 
Join Date: Apr 2006
Posts: 23
Downloads: 0
Uploads: 0
Default

Hi minsc_tdp!

Thanks for your answer, I will try that later on for IL-2 and publish it, of course only if you don´t mind!

But so far I can´t stop bombing you with problems, sorry for that
I added some other speech commands, as for example "battlestation".

I added the refering entries in the key_codes.csv, key_commands.csv and voice_commands.csv. When the speech recognition is activated, following problem appears:

phyton.exe correctly shows
"battlestation 1186415552.0" (I don´t know what this number means though)

but in a way this is not correctly converted. The programme that makes the key being "pushed" shows this:

Battlestation
Pressing key Bà..
Use of uninitialized value in pattern match (m//) at go.pl line 102
Use of uninitialized value in hex at go.pl line 118.


This phenomenon also appears with several other commands, but not with all altough I can´t detect any differences in the way I entered them. Do you know what this can be caused by?

Thanks a lot
__________________
"War does not determine who´s right, only who´s left" - Bertrand Russel
moselgott is offline   Reply With Quote
Old 08-06-07, 01:25 PM   #37
minsc_tdp
XO
 
Join Date: Mar 2007
Posts: 411
Downloads: 1
Uploads: 0
Default

Quote:
Originally Posted by moselgott
Thanks for your answer, I will try that later on for IL-2 and publish it, of course only if you don´t mind!
Of course not, I GPL'd the source so just keep that license with it to ensure everything stays open for everyone.

Quote:
I added some other speech commands, as for example "battlestation".
I added the refering entries in the key_codes.csv, key_commands.csv and voice_commands.csv. When the speech recognition is activated, following problem appears:

phyton.exe correctly shows
"battlestation 1186415552.0" (I don´t know what this number means though)

but in a way this is not correctly converted. The programme that makes the key being "pushed" shows this:

Battlestation
Pressing key Bà..
Use of uninitialized value in pattern match (m//) at go.pl line 102
Use of uninitialized value in hex at go.pl line 118.
Something is wrong in one of the CSV files. Show me all your entries that relate to this command from all three files. I'm pretty sure it's in the key_codes.csv for "B", the key code is probably incorrect or missing. That "Bà" tells me something is wrong there. Try deleting that à and make sure the virtual key code is entered and correct, and make sure the scan code is 0x00 for now.

I'm thinking of cleaning this whole thing up and condensing it down to two files - one for SH4 commands with associated keys and virtual key codes all in one file, and one for the voice commands. What do you guys think? Are we in too deep with what we have?
__________________
June 29 2016 - shSpeech v2.55 - Voice Command for Silent Hunter 4! View Thread

Last edited by minsc_tdp; 08-06-07 at 01:50 PM.
minsc_tdp is offline   Reply With Quote
Old 08-06-07, 02:02 PM   #38
minsc_tdp
XO
 
Join Date: Mar 2007
Posts: 411
Downloads: 1
Uploads: 0
Default

By the way all, I'm back from my vacation and while I have some catching up to do with work, I plan to get on this flank speed this week with some (hopefully) amazing updates. In general I think what it needs most is a proper installer and a troubleshooter script to help detect issues before allowing the scripts to just run and sink. There's a known bug where a timing issue causes the Perl script to be unable to get the voice command that the Python script detected. There's some basic keys that should have already been added to the key_codes.csv and some cleanup there too since the scancodes aren't even being used and probably never will. The mouse support feature will be worked on after all of these other bugs are fixed (kind of like how I actually complained about adding the Colorado to SH4 when there were still so many bugs to work on. Devs tend to lean toward working on "interesting" things rather than necessary things.)
__________________
June 29 2016 - shSpeech v2.55 - Voice Command for Silent Hunter 4! View Thread
minsc_tdp is offline   Reply With Quote
Old 08-06-07, 03:11 PM   #39
moselgott
Watch
 
Join Date: Apr 2006
Posts: 23
Downloads: 0
Uploads: 0
Default

Hi again!

I´ve found my mistake. In the key_commands my entry for "B" and the other commands that didn´t work looked like this:

81,Key,Battlestation,B.....

and not

81,Key,Battlestation,B,,,,,

such a shallow detail, but so important...nevertheless, if one door shuts, another opes; or the other way round:

A question that is not related to this topic: How can I include a hotkey for "select tube 7 (8,9,10)", because in the commands.cfg of SH4 only there is only an entry for tubes 1-6.

Thanks in advance (and sorry for my continuous asking...)
Moselgott!

EDIT: Ok, I think there´s another problem. If pushing Ctrl+F1 (my choice for "select Tube 1"), Tube 2 is selected. If pushing Ctrl+F2, Tube 3 is selected until pushing Ctrl+F6, then Tube 7 is sleceted. No chance to select tubes 1,8,9,10 w/o using the mouse or cycling tubes.
What´s that?
__________________
"War does not determine who´s right, only who´s left" - Bertrand Russel

Last edited by moselgott; 08-06-07 at 03:45 PM.
moselgott is offline   Reply With Quote
Old 08-06-07, 05:23 PM   #40
minsc_tdp
XO
 
Join Date: Mar 2007
Posts: 411
Downloads: 1
Uploads: 0
Default

I'll have to fix the bug where if there's no comma after the B that it fails. That's a stupid bug and my own fault.

Regarding "select tube x" I haven't looked at anything other than the default keys according to the reference card. I have to focus on defaults so that it works for everyone. I haven't even looked at the CFG file you speak of.

For those extra tubes, it sounds like SH4 does not allow you to map ANY key to open tubes over 6. So in that case you're basically screwed for now since I only support keys. When we get mouse support in maybe I could get that going, but I didn't know there even WERE subs with more than 6 tubes. I guess those are different boats, which introduces a difficult problem: I presume the tube control panel will look different, and in that case, I'll need to define correct mouse coords for every torpedo control panel type and give you a way to indicate which one you're using, since it would be impossible for it to figure that out on it's own. Sounds like a lot of work... [groan]
__________________
June 29 2016 - shSpeech v2.55 - Voice Command for Silent Hunter 4! View Thread
minsc_tdp is offline   Reply With Quote
Old 08-06-07, 06:08 PM   #41
minsc_tdp
XO
 
Join Date: Mar 2007
Posts: 411
Downloads: 1
Uploads: 0
Default

Welcome Google searchers. I don't know why it dumps you on Page 3 (must be a good page) so you should probably start at the beginning:
http://www.subsim.com/radioroom/showthread.php?t=119430


Quote:
Originally Posted by moselgott
EDIT: Ok, I think there´s another problem. If pushing Ctrl+F1 (my choice for "select Tube 1"), Tube 2 is selected. If pushing Ctrl+F2, Tube 3 is selected until pushing Ctrl+F6, then Tube 7 is sleceted. No chance to select tubes 1,8,9,10 w/o using the mouse or cycling tubes.
What´s that?
lolwut?

How about this: With my latest changes you can chain commands together using the & symbol. If you start the game and don't touch any of the tube selection keys and only use voice, we could set it up to open tube 8 by hitting the cycle key 7 times (from 1), toggling that tube, and cycling 3 more times to go back to tube 1. I don't know how fast you can mash these keys into SH4 and have it get them right but it's worth a shot. I already made a fix where you can chain together as many keystrokes as you want but I haven't uploaded it yet.
__________________
June 29 2016 - shSpeech v2.55 - Voice Command for Silent Hunter 4! View Thread

Last edited by minsc_tdp; 10-25-07 at 03:03 PM.
minsc_tdp is offline   Reply With Quote
Old 08-06-07, 09:51 PM   #42
minsc_tdp
XO
 
Join Date: Mar 2007
Posts: 411
Downloads: 1
Uploads: 0
Default

Quote:
"battlestation 1186415552.0" (I don´t know what this number means though)
By the way, that number is just a unique timestamp that is used to check and see if the command read is different from the previous command to ensure that if you say the same thing twice, it acts on the second as well as the first, since hear.py would otherwise only send the command itself to the Perl script (via a text file write) and it wouldn't know if it changed. Just a hack, ignore it.
__________________
June 29 2016 - shSpeech v2.55 - Voice Command for Silent Hunter 4! View Thread
minsc_tdp is offline   Reply With Quote
Old 08-06-07, 10:57 PM   #43
minsc_tdp
XO
 
Join Date: Mar 2007
Posts: 411
Downloads: 1
Uploads: 0
Default 1.1 released!

Download URL:
v1.1: http://knepfler.com/sh4speech1.1.zip (~ 7 MB)

CHANGES IN THIS RELEASE
-----------------------

1.1 Bugfix release and minor enhancements

Bug Fixes:
Cleaned up extra commas from CSVs and fixed bug where it would fail without them (added a chomp() to each line read)
Lowered $KEY_HOLD (time to hold down keys) from 0.1 seconds to 0.05 seconds
Moved the launch of hear.py into the two BAT files since sometimes the Perl script may not launch it correctly.
Added a check in the perl script on the phrase.tmp file to prevent reading it while it's being written which caused a rare failure
Added a global variable $MULTI_KEY_DELAY to determine wait time between key presses for multi-key sequences and set it to 0.1 second
Updated bad download URLs in readme

New Features and Improvements:
Added command chaining support using & symbol in key_commands.csv. See Raise All Masts at the bottom of that file for an example.
Drastically improved the text output from both windows to make more sense and help a little with debugging and general understanding
Improved the code readability for anyone who might be trying to match up my perl hashes to the CSV files
Switched to Creative Commons license since it's easier to understand
Added several missing keys to key_codes.csv and alphabetized them for readability, so you can try more keys in key_commands.csv without having to bother to figure out the code stuff

Compatibility
No changes were made to the CSVs that would prevent you from using modified ones from v1.0 with this release.
__________________
June 29 2016 - shSpeech v2.55 - Voice Command for Silent Hunter 4! View Thread

Last edited by minsc_tdp; 08-07-07 at 01:54 PM.
minsc_tdp is offline   Reply With Quote
Old 08-07-07, 07:27 AM   #44
moselgott
Watch
 
Join Date: Apr 2006
Posts: 23
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by minsc_tdp
Quote:
Originally Posted by moselgott
EDIT: Ok, I think there´s another problem. If pushing Ctrl+F1 (my choice for "select Tube 1"), Tube 2 is selected. If pushing Ctrl+F2, Tube 3 is selected until pushing Ctrl+F6, then Tube 7 is sleceted. No chance to select tubes 1,8,9,10 w/o using the mouse or cycling tubes.
What´s that?
lolwut?

How about this: With my latest changes you can chain commands together using the & symbol. If you start the game and don't touch any of the tube selection keys and only use voice, we could set it up to open tube 8 by hitting the cycle key 7 times (from 1), toggling that tube, and cycling 3 more times to go back to tube 1. I don't know how fast you can mash these keys into SH4 and have it get them right but it's worth a shot. I already made a fix where you can chain together as many keystrokes as you want but I haven't uploaded it yet.
I think a chain system is a valuable addition to that. A good use for it would be "open all tubes" (w&q&w&q&w....), but I think it is not usable for selecting singular tubes, because in order to get from tube 6 to tube 1 you would have to say "select tube 5", so that 5 tubes are cycled to reach tube 1. Did I get that right? If yes, I wouldn´t like, but it is likable for other commands though.

Nontheless I couldn´t solve my problem. Why is tube 2 selected when pushing Ctrl+F1? And why is there no possibility to select tubes 1,8,9,10?
__________________
"War does not determine who´s right, only who´s left" - Bertrand Russel
moselgott is offline   Reply With Quote
Old 08-07-07, 10:32 AM   #45
Fraggulus
Swabbie
 
Join Date: Jul 2007
Posts: 7
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by minsc_tdp
Fraggulus - the only thing I could possibly recommend there is to make sure to install Microsoft SAPI 5.1 SDK for Windows Vista, if such a thing exists. I know that Vista includes a new version of the speech engine, version 6.0+, and it's possible that hear.py is trying to hook into 5.1 which simply isn't there. ..
hi minsc_tdp,

I didn't find any SDK for Vista. Maybe because of the already built-in speech recognition??
Fraggulus is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.