Skip to content

Instantly share code, notes, and snippets.

Last active Jun 10, 2017
What would you like to do?
Run an audio file through speech-to-text via CMU Sphinx on macOS

Install homebrew


Install CMU Sphinx


$ brew tap watsonbox/cmu-sphinx
$ brew install --HEAD watsonbox/cmu-sphinx/cmu-sphinxbase
$ brew install --HEAD watsonbox/cmu-sphinx/cmu-pocketsphinx

Install ffmpeg

$ brew install ffmpeg

Prepare the audio using ffmpeg:

$ ffmpeg -i INPUT_FILE -ac 1 -ar 16000 output.wav
  • -ac 1 means mono
  • -ar 16000 means 16 KHz sample rate


$ pocketsphinx_continuous -infile output.wav > output.txt

A lot of output will be generated but the text will go to output.txt. You can monitor its progress in another shell:

$ tail -f output.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment