I want to program a VoiceRecognition with Pocketsphinx and start it with Eclipse. At first I built pocketsphinx and sphinxbase and I was able to start pocketsphinx_continuous.exe with cmd.
Now I have some Problems with the c-source, to start the microphone and the recognition.
JNIEXPORT void JNICALL Java_Test_Decoder_1defaultConfig(JNIEnv *env, jobject obj)
{
config = cmd_ln_init(NULL, ps_args(), TRUE, // Load the configuration structure - ps_args() passes the default values
"-hmm", MODELDIR "/en-us/en-us", // path to the standard english language model
"-lm", MODELDIR "/en-us/en-us.lm.bin", // custom language model (file must be present)
"-dict", MODELDIR "/en-us/cmudict_en_us.dict", // custom dictionary (file must be present)
NULL);
if (config == NULL) {
cmd_ln_free_r(config);
E_INFO("configuration failed");
}
ps_default_search_args(config);
ps = ps_init(config); // initialize the pocketsphinx decoder
if (ps == NULL) {
cmd_ln_free_r(config);
E_INFO("decoder failed");
}
E_INFO("COMPILED ON %s, AT: %s\n",__DATE__,__TIME__);
recognize_from_microphone(); // call the function to capture and decode speech
ps_free(ps);
cmd_ln_free_r(config);
//ad_close(ad); // close the microphone
}
static void recognize_from_microphone() {
ad_rec_t *ad;
int16 adbuf[2048];
uint8 utt_started, in_speech;
int32 k;
char const *hyp;
//if (ad = ad_open_dev(NULL, (int)cmd_ln_float32_r(config, "-samprate")) == NULL) { // open default microphone at default samplerate
// E_FATAL("Failed to open audio device\n");
// }
if ((ad = ad_open()) == NULL) { // open default microphone at default samplerate
E_FATAL("Failed to open audio device\n");
}
if (ad_start_rec(ad) < 0) {
E_FATAL("Failed to start recording\n");
}
if (ps_start_utt(ps) < 0)
E_FATAL("Failed to start utterance\n");
utt_started = FALSE;
E_INFO("Ready....\n");
If i start it with Eclipse I get the following Error message:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000022dfbfc, pid=7780, tid=0x0000000000003320
#
# JRE version: OpenJDK Runtime Environment (8.0_74-b02) (build 1.8.0_74-b02)
# Java VM: OpenJDK 64-Bit Server VM (25.74-b02 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [pocketsphinx.dll+0x1fbfc] ps_start_utt+0x1c
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# D:\sde\workspaceAW_4.5\pocketsphinx\hs_err_pid7780.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
It says that the Problem is inside the ps_start_utt function, but I did not change the Default/demo function. Is the Mistake in the function or is there any mistake before?