1.sudo apt-get install libasound2-dev &&&&&&rename sphinxbase_1XXXX to sphinxbase
2. ./auto...sh
3. ./configure
4. make
5 sudo make install
6. repeat the step 2~5 in dirctory pocketsphinx
7. sudo vim /etc/ld.so.conf ADD include /usr/local/lib include /usr/local/lib/pkgconfig
THEN sudo ldconfig
8.TEST the installtion input the command :pkg-config –cflags –libs pocketsphinx sphinxbase
IF the terminal gives :I/usr/local/include -I/usr/local/include/sphinxbase -I/usr/local/include/pocketsphinx -L/usr/local/lib -lpocketsphinx -lsphinxbase -lsphinxad
CONGRATULATIONS!!!!!!!!!!!!!!!!!!!!!!!
9.create a hello_ps.c file
/*hello_ps.c*/
#include <pocketsphinx.h>
intmain(int argc, char *argv[])
{
ps_decoder_t *ps;
cmd_ln_t *config;
config = cmd_ln_init(NULL, ps_args(),
TRUE, "-hmm", MODELDIR "/hmm/en_US/hub4wsj_sc_8k",
"-lm", MODELDIR "/lm/en/turtle.DMP", "-dict",
MODELDIR "/lm/en/turtle.dic", NULL);
if (config == NULL)
return 1;
return 0;
}
NOTE:THIS IS VERY IMPORTANT !!!!!!!!!!!!!!!!!!!! Cause it makes me FUCKED very much just for the makefile reason
The Makefile should just as follows:
#Makefile for sphinx cmu
obj=hello_ps
modeldir=$(shell pkg-config --variable=modeldir pocketsphinx)
flags=$(shell pkg-config --cflags --libs pocketsphinx sphinxbase)
$(obj):$(obj).c
gcc $(obj).c -o $(obj) -DMODELDIR=\"$(modeldir)\" $(flags)
.PHONY:clean
clean:
clear
rm -rf *.o $(obj)
#NOTE It's a TAB KEY before gcc and rm -rf *.o $(obj) not some space keys
.PHONY:clean
clean:
rm -rf *.o $(obj)