First step of developing Sphinx applications

I wrote about installing Sphinx3 last time. It can be possible to integrate speech recognition in your applications with Sphinx3 API. Before we can go to further step, we have to know how to compiling and link library to you programs. I testes that by copying files main_livedecode.c and main_livepretend.c in sphinx3/src/programs to my directory. Then I write a simple make file to build it as follows

CXX = g++
CXXFLAGS = -g -O2 -Wall -I/usr/local/include/sphinx3 -I/usr/local/include/sphinxbase
LIBS = -L/usr/local/lib -ls3decoder -lsphinxad -lsphinxbase -lm  
 
all: main_livedecode.o main_livepretend.o
	$(CXX) $(CXXFLAGS) -o main_livedecode main_livedecode.o $(LIBS)
	$(CXX) $(CXXFLAGS) -o main_livepretend main_livepretend.o $(LIBS)
 
main_livedecode.o: main_livedecode.c
	$(CXX) $(CXXFLAGS) -c $<
 
main_livepretend.o: main_livepretend.c
	$(CXX) $(CXXFLAGS) -c $<
 
clean:
	rm -rf *.o
	rm -rf *~
	rm -rf *.raw
	rm -f main_livedecode main_livepretend
 
.PHONY: clean

After this you can study how it work in files main_livedecode.c and main_livepretend.c.

Related Posts

Leave a Reply