Here is an example I developed to test live real-time speech recognition using CMU Sphinx and the PortAudio library. The example works on both Windows and Linux. I've tested it with sphinxbase v0.3 and sphinx3 v0.7, but not with the latest source trees from CMU.
The example is a simple command line program that:
- Lists the details of all the audio devices found.
- Plays a sine wave beep.
- Records 16-bit 16kHz audio.
- Streams audio to Sphinx-3 decoder, showing intermediate hypotheses.
- Writes final 1-best recognition to a file (simple.txt).
- Writes recognition lattice to a file (simple.lat.gz).
- Saves the raw audio to a file (simple.raw).
- Plays back the recording.
- Allows audio input/output devices to be specified via the command line.