General Discussion

Flat
Sphinx 4/ Audio cache and Speech recognizer issues
User: butterballs
Date: 6/29/2010 8:37 pm
Views: 5310
Rating: 3

I have a an art gallery opening tomorrow.  Yeah I know.  I've been trying to
fix this memory issue for two weeks now with no avail.
The skinny:
Here's the code I've started with. http://pastebin.org/366431  Basically,
here's what the program is supposed to do:  It's supposed to initialise a
speech recognizer, and a microphone.  Supposed to find tweets specified by an
external file that has the grammar words "love" "hate" "sad" etc.  It's
supposed to speak the words when recognized and while it is speaking the
microphone turns off.  Then it is supposed to listen for the key word which
is spoken and loop this procedure.  The problem I'm having is that i'm
running out of memory and getting out of memory java heap error. I've upped
my cache to 500 mb and changed the configuration files to match, and I'm
still running out.

This is due to one thing and one thing only:  the recognizer allocation. It's
somehow meant to be in the constructor.

I'm not sure how to get the allocater out of the loop and have it work.  

I'm supremely desperate and I've looked everywhere.  They may not let me
exhibit if I can't get the error fixed.  

Here is an alternate code that someone suggested.  It's not right but maybe
it's closer than the first.

http://pastebin.org/367378

If anyone knows how to solve this issue i would greatly appreciate it!

--- (Edited on 6/29/2010 8:37 pm [GMT-0500] by butterballs) ---

Re: Sphinx 4/ Audio cache and Speech recognizer issues
User: nsh
Date: 6/30/2010 4:10 am
Views: 2239
Rating: 5

> Here is an alternate code that someone suggested. 

> It's not right but maybe it's closer than the first.
> http://pastebin.org/367378
>  If anyone knows how to solve this issue i would greatly appreciate it!


You here as well. Heh, this code is indeed better but the issue is that in Java string comparision is not done with ==, it's done with equals. Read this:

http://www.devdaily.com/java/edu/qanda/pjqa00001.shtml


You should better use

recognizer.getState()  == Recognizer.ALLOCATED

and compare enums instead of strings

As for allocation in constructor, this chunk will probably give you and idea.:

 

class MyApplet {
  Recognizer recognizer;
  Microphone microphone;
  init() {
     recognizer = cm.get("recognizer");
     recognizer.allocate;
  }
  run () {
     Result = recognizer.recognize();
  }
}

--- (Edited on 6/30/2010 13:10 [GMT+0400] by nsh) ---

PreviousNext