First of all make sure you are using fixed point operations and your dictionary and language models are small enough.
How do I make it fast?
The default settings are not enough to achieve sub-realtime performance on most tasks. Here are some command-line flags you should experiment with:
-dsratio
- In most cases -dsratio 2 gives the best performance, though accuracy suffers a bit.
-topn
- The default value is 4, the fastest value is 2, but accuracy can suffer a bit depending on your acoustic model.
-lpbeam
- This beam is quite important for performance, however the default setting is pretty narrow already. Run pocketsphinx_batch with no arguments to see what it is.
-lponlybeam
- Likewise here as with -lpbeam. If you are finding it hard to get enough accuracy, you can widen these beams.
-maxwpf
- This can be set quite low and still give you reasonable performance - try 5.
-maxhmmpf
- Depending on the acoustic and language model this can be very helpful. Try 3000.
-kdtreefn
If you are using the models provided with PocketSphinx (model/hmm/6k), pass the kdtrees file included with them using this argument. You could also make your own kd-trees with the mk_s3gau and kdtree programs in SphinxTrain.
-kdmaxdepth
- You can play around with this. Values from 1 to 10 are possible with the default kdtrees file. Higher values use more memory. Values between 5 and 7 seem to work well for some reason.
-kdmaxbbi
- Tuning this might help too. Try 16 and go up or down to see how speed and accuracy are affected. Too low and both will suffer, too high and it won't make a difference.