Simple PocketSphinx c++ wrapper
This is a simple wrapper for Pocketsphinx in c++. This is still in it’s early state. It contains a lot of the code from the PocketSphinx tutorial. Below is a simple cpp program that uses the Ears class.
compile with
g++ -W -o outFile infile.cpp \ -DMODELDIR=\"`pkg-config --variable=modeldir pocketsphinx`\" \ `pkg-config --cflags --libs pocketsphinx sphinxbase`
example.cpp
//Ears class test //Written by: Bill Heaster //TheCreator at ApexLogic d0t net #include <iostream> #include <string> #include "ears.h" #include "ears.cpp" //used for errors in code::Blocks using namespace std; int main() { //create new ears object Ears ears; //this is the location of the file we will be comparing against our langauge model std::string fileLoc = "goforward.raw"; //holds the decoded string std::string outputString; if(ears.init()>0) { cerr<<"error on init"<<endl; return 1; } //process the .raw file and store the string outputString = ears.rawToString(fileLoc.c_str()); //print to terminal cout<<endl<<outputString<<endl; return 0; }
Source:
EarsClass.tar.gz
Testfile.cpp
EarsClass.cpp
EarsClass.h
goforward.raw