المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : TCP Client/Server and Speech Recognition



C# Programming
06-08-2009, 10:21 PM
Hi,
I'm doing a small program to work with SAPI (Speech Recognition).
The main goal of the program is a client send a WAV file from a TCP client, and a server receive it and store it in hard disk. Then before closing the TCP connection, I want to "recognize" the file saved.

The problem I'm getting is, after the file is saved, I go to the function that does the speech recognition. When I go on debug, the events of speech recognition doesn't fire up. I've tried and in a stand-alone version (i only input a WAV and then do the voice recognition part) and it works.

Maybe some code to help:

After TCPListner and TCPClient
.....

FileStream fs = new FileStream(@"C:\\" + filenameOnly, FileMode.Create);
... and then I write a buffer[] (from a StreamReader) to a file.
fs.Flush();
fs.Close();
..... Then I call the SR functions and declare the events.

//wave file created before....yes, i can open when we enter this code.
sr.SetInputToWaveFile(ficheiro);

//these event aren't raised.
sr.SpeechRecognized += new EventHandler(sr_SpeechRecognized);
//
sr.SpeechHypothesized += new EventHandler(sr_SpeechHypothesized);
//
sr.SpeechRecognitionRejected += new EventHandler(sr_SpeechRecognitionRejected);
//
sr.RecognizeAsync(RecognizeMode.Multiple);



Any suggestion?

Thanks in forward.