#include <stdio.h>#include <stdlib.h>#include <string.h>#include <assert.h>#include <sphinxbase/err.h>#include <sphinxbase/ad.h>#include <pocketsphinx.h>intmain(intargc,char*argv[]){ps_decoder_t*ps;cmd_ln_t*config;FILE*fh;charconst*hyp,*uttid;int16buf[512];intrv;int32score;printf("Test VoiceRecon Start\n");config=cmd_ln_init(NULL,ps_args(),TRUE,"-hmm","F:/ProyectoXP/VoiceRecon/model/","-lm","F:/ProyectoXP/VoiceRecon/model/1851.lm","-dict","F:/ProyectoXP/VoiceRecon/model/1851.dic",NULL);printf("Config Set Done\n");if(config==NULL){printf("Config Fail\n");fprintf(stderr,"Failed to create config object, see log for details\n");return-1;}ps=ps_init(config);if(ps==NULL){printf("Decoder Fail\n");fprintf(stderr,"Failed to create recognizer, see log for details\n");return-1;}fh=fopen("goforward.raw","rb");if(fh==NULL){printf("File Fail\n");fprintf(stderr,"Unable to open input file goforward.raw\n");return-1;}rv=ps_start_utt(ps);while(!feof(fh)){size_tnsamp;nsamp=fread(buf,2,512,fh);rv=ps_process_raw(ps,buf,nsamp,FALSE,FALSE);}printf("File Processed\n");rv=ps_end_utt(ps);hyp=ps_get_hyp(ps,&score);printf("Recognized: %s\n",hyp);fclose(fh);ps_free(ps);cmd_ln_free_r(config);printf("End Test\n");return0;}
Libs, Includes, etc done, perfect compile with no errors (on Windows 10 and DEV-C++ 5.11), getting VoiceRecon.exe
Run in a windows CMD, Output:
F:\ProyectoXP\VoiceRecon>VoiceRecon.exe
Test VoiceRecon Start
F:\ProyectoXP\VoiceRecon>
No errors returns, no nothing, but looks like never get to the "printf("Config Set Done\n");" line.
What is wrong with config call? HELP!!
Dego
Last edit: Diego Rapal 2021-04-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Attention to details will help you in your programming career.
As for exit after start, it exits because it fails to find the dlls (sphinxbase and pocketsphinx). They must be in the same folder where you run the program. You can use dll explorer to make sure dlls are present.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for your help Nikolay, about DLLs they are in the same folder.
Extra info, running "pocketsphinx_continuous,exe" in same folder with same hmm, lm, dict parameters (in command line) works perfect!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You mean when compiling my code or something in the compilation of the dlls?,
I have not recompiled the dlls but they work perfectly with the continuous.exe
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, you can try to remove -static-libgcc from the flags, it might help. Otherwise you'd better recompile pocketsphinx/sphinxbase with mingw too. Or you use MSVC to compile your binary since libraries were built with msvc.
In general the rule is that you use single compiler for all the libs and binaries in the project. On Windows they are not easily cross-compatible due to different runtimes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I will try what you indicate, I see clearly that the problem is compilation, I have compiled the continuous.c and I have the same symptom, although using the one included in the package works fine, it is clear that the dll and the exe must be compiled in the same environment
thank you very much for your help!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To close and if help others, the problem was to include the .lib files in the compilation, only including the .dll files the compilation worked correctly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To close and if help others, the problem was to include the .lib files in the compilation, only including the .dll files the compilation worked correctly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My code (basically the tutorial hello world code)
Libs, Includes, etc done, perfect compile with no errors (on Windows 10 and DEV-C++ 5.11), getting VoiceRecon.exe
Run in a windows CMD, Output:
No errors returns, no nothing, but looks like never get to the "printf("Config Set Done\n");" line.
What is wrong with config call? HELP!!
Dego
Last edit: Diego Rapal 2021-04-25
Can you format the code properly? You can use markdown syntax or just the vyswyg editor.
upload the CPP file.
Please click edit button in your original post and format the code properly.
Sorry, just Idk how, I read Formating Help section and I think is fine now, is ok?
Sorry my english, no a native english speaker. :-(
Looks good now, thank you!
Attention to details will help you in your programming career.
As for exit after start, it exits because it fails to find the dlls (sphinxbase and pocketsphinx). They must be in the same folder where you run the program. You can use dll explorer to make sure dlls are present.
Thanks for your help Nikolay, about DLLs they are in the same folder.
Extra info, running "pocketsphinx_continuous,exe" in same folder with same hmm, lm, dict parameters (in command line) works perfect!
Then you need to check compilation params. It is something about dll, not about your code. It crashes when it plugs first sphixnbase functions.
You mean when compiling my code or something in the compilation of the dlls?,
I have not recompiled the dlls but they work perfectly with the continuous.exe
This is my makefile:
Did you compile pocketsphinx_batch.exe and pocketsphinx.dll with mingw or with a visual studio?
No i dont, is that a MUST?
I asked mingw OR with a visual studio
I do not recompile any dll or exe from the sphinx package.
Ok, you can try to remove -static-libgcc from the flags, it might help. Otherwise you'd better recompile pocketsphinx/sphinxbase with mingw too. Or you use MSVC to compile your binary since libraries were built with msvc.
In general the rule is that you use single compiler for all the libs and binaries in the project. On Windows they are not easily cross-compatible due to different runtimes.
I will try what you indicate, I see clearly that the problem is compilation, I have compiled the continuous.c and I have the same symptom, although using the one included in the package works fine, it is clear that the dll and the exe must be compiled in the same environment
thank you very much for your help!
To close and if help others, the problem was to include the .lib files in the compilation, only including the .dll files the compilation worked correctly.
To close and if help others, the problem was to include the .lib files in the compilation, only including the .dll files the compilation worked correctly.