How to use multiple keywords in Pocketsphinx continuous mode

・1 min read

Create a dictionary file containing all the words that will be used. You can use the CMU Sphinx Pronouncing Dictionary to get the phonemes for English dictionary words.

keyphrase.dic:

CAT K AE T
DOG D AO G
FISH F IH SH

Create a keyphrase list file with a threshold for each phrase. Defaults to 1. Lower thresholds increase the number of matches but might also increase the number of false alarms.

keyphrase.list:

CAT /1e-15/
DOG /1e-15/
FISH /1e-12/

Run pocketsphinx_continuous command with microphone as input:

pocketsphinx_continuous -inmic yes -kws keyphrase.list -dict keyphrase.dic

Or you can you a specified audio file:

pocketsphinx_continuous -infile dog.wav -kws keyphrase.list -dict keyphrase.dict

Use sox to record audio files from the command line:

sox -d -c 1 -r 16000 -e signed -b 16 dog.wav

Subscribe

Receive updates on new posts.