BrunoMoureau / PocketSphinxXam

Speech Recognition with PocketSphinx in Xamarin.Forms project (only available for Android)
Other
3 stars 4 forks source link

Timeout #2

Closed DKanarsky closed 3 years ago

DKanarsky commented 6 years ago

I wonder why handling timeout code in SpeechRecognizer.cs is commented?

        //// If we met timeout signal that speech ended
        //if (timeoutSamples != NO_TIMEOUT && remainingSamples <= 0)
        //{
        //    Log.Debug(TAG, "Timeout");
        //    OnTimeout();
        //}
BrunoMoureau commented 6 years ago

Hello, I think I didn't need to handle timeout in the project in which I used PocketSphinx. I guess I kept it commented only for information purpose.

If I remember well, I just had to start and stop the speech recognition at a given time.

DKanarsky commented 6 years ago

Hi! Ok, thanks for the reply. Your example helped me a lot!

DKanarsky commented 6 years ago

One more question... What do your think about CMU Sphinx vs. Google API? What is the benefit of using CMU Sphinx in adnroid os?

BrunoMoureau commented 6 years ago

For my project, I had to make a continuous speech recognition system. I tried to use Google API first but I noticed some limitations :

These are three advantages that was really relevant in my case but there are certainly many others. If you have more questions, I'll try to answer you the best as I can.

Sorry if I made some mistakes but english isn't my native language :)

DKanarsky commented 6 years ago

Thanks! I tested my first xamarin speech recognize application based on your code. I needed to implement some commands recognition after a keyword. I slightly edited your code and also set up a timeout (3 sec). But I noticed that if a person kept speeking long after a keyword timeout didn't work. It was listening till the end of the speech. I wonder if it could be handled. I looked through your code again and found _decoder.GetInSpeech() method and that timeout depended on it. I think this is what I need but I don't completely undestand how it works. Besides I looked through Sphinx tutorial again and android demo project. It is said that "the SpeechRecognizer is the main class to access decoder functionality" but I didn't find implemetation of that class. Is your SpeechRecognizer.cs based on the original class?

Sorry if I made some mistakes but english isn't my native language :) Neither my)

BrunoMoureau commented 6 years ago

Well, I am sorry but I can't help you for the timeout because I don't really know how to make it works. To answer your last question, the SpeechRecognizer.cs file is based on the original java class you can find in Sphinx package. There is a private field in the class for the decoder : _decoder = new Decoder(config); I think this is what you are looking for when you talk about "access to decoder functionality" (for example) : _recorder.StartRecording();