0

On some devices (none of the actual test devices), I get a force close when I start PocketSphinx recognition, the crash report is as follows (note it was previously obfuscated):

java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
at android.media.AudioRecord.startRecording(AudioRecord.java:515)
at edu.cmu.pocketsphinx.SpeechRecognizer.setSearch(Unknown Source)
at edu.cmu.pocketsphinx.SpeechRecognizer$1.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:155)
at android.os.HandlerThread.run(HandlerThread.java:60)

Based on the crash reports, it seems that it is not specific to a certain device...

enter image description here

Ryan S
  • 4,549
  • 2
  • 21
  • 33
  • 1
    The error says that audiorecord can not be initialized. Most like it can't record at 16khz and you need to use 8khz model (hub4wsj_sc_8k) instead of en_us_semi. You also need to change samplerate in config. – Nikolay Shmyrev Feb 25 '14 at 22:19
  • @NikolayShmyrev Is there any advantage to using the 16khz mmodel? Would it be worth it to include both and allow users to choose between them? – Ryan S Feb 26 '14 at 01:39
  • 1
    No, there is no great advantage in that, 8khz model is also ok for keyword activation. See also http://stackoverflow.com/questions/8043387/android-audiorecord-supported-sampling-rates – Nikolay Shmyrev Feb 26 '14 at 08:01
  • I changed to the 8khz model, but was still having trouble and I realized that PocketSphinx wasn't calling release on its AudioRecord object so I fixed this, but I still get this issue sporadically... I'm going to try to add a wait for initialization check to see if this fixes it... – Ryan S Mar 04 '14 at 18:43

0 Answers0