POCKETSPHINX(1)

NAME
pocketsphinx - Run speech recognition on audio data

SYNOPSIS
pocketsphinx [ options... ] [ live | single | help | soxflags ] INPUTS...

DESCRIPTION

The ‘pocketsphinx’ command-line program reads single-channel 16-bit PCM audio one or more input files (or ‘-’ to read from standard input), and attempts to recognize speech in it using the default acoustic and language model. The input files can be raw audio, WAV, or NIST Sphere files, though some of these may not be recognized properly. It accepts a large number of options which you probably don't care about, and a command which defaults to ‘live’. The commands are as follows:

help
    Print a long list of those options you don't care about.

config
    Dump configuration as JSON to standard output (can be loaded with the ‘-config’ option).

live
    Detect speech segments in input files, run recognition on them (using those options you don't care about), and write the results to standard output in line-delimited JSON. I realize this isn't the prettiest format, but it sure beats XML. Each line contains a JSON object with these fields, which have short names to make the lines more readable:

    "b": Start time in seconds, from the beginning of the stream

    "d": Duration in seconds

    "p": Estimated probability of the recognition result, i.e. a number between 0 and 1 which may be used as a confidence score

    "t": Full text of recognition result

    "w": List of segments (usually words), each of which in turn contains the ‘b’, ‘d’, ‘p’, and ‘t’ fields, for start, end, probability, and the text of the word. In the future we may also support hierarchical results in which case ‘w’ could be present.

single
    Recognize the input as a single utterance, and write a JSON object in the same format described above.

align
    Align a single input file (or ‘-’ for standard input) to a word sequence, and write a JSON object in the same format described above. The first positional argument is the input, and all subsequent ones are concatenated to make the text, to avoid surprises if you forget to quote it. You are responsible for normalizing the text to remove punctuation, uppercase, centipedes, etc. For example:
            pocketsphinx align goforward.wav "go forward ten meters"
    By default, only word-level alignment is done. To get phone alignments, pass `-phone_align yes` in the flags, e.g.:
            pocketsphinx -phone_align yes align audio.wav $text
    To get state-level alignments, pass `-state_align yes` (this automatically enables phone alignment as well):
            pocketsphinx -state_align yes align audio.wav $text
    This will make not particularly readable output, but you can use jq (https://stedolan.github.io/jq/) to clean it up. For example, you can get just the word names and start times like this:
            pocketsphinx align audio.wav $text | jq '.w[]|[.t,.b]'
    Or you could get the phone names and durations like this:
            pocketsphinx -phone_align yes align audio.wav $text | jq '.w[]|.w[]|[.t,.d]'
    There are many, many other possibilities, of course.

help
    Print a usage and help text with a list of possible arguments. You can also get command-specific help by specifying a command after help, for example 'pocketsphinx help align' will show alignment-specific options.

help-config
    Print a long list of all configuration parameters with their descriptions.

soxflags
    Return arguments to ‘sox’ which will create the appropriate input format. Note that because the ‘sox’ command-line is slightly quirky these must always come after the filename or ‘-d’ (which tells ‘sox’ to read from the microphone). You can run live recognition like this:
            sox -d $(pocketsphinx soxflags) | pocketsphinx -
    or decode from a file named "audio.mp3" like this:
            sox audio.mp3 $(pocketsphinx soxflags) | pocketsphinx -

By default only errors are printed to standard error, but if you want more information you can pass ‘-loglevel INFO’. Partial results are not printed, maybe they will be in the future, but don't hold your breath. Force-alignment is likely to be supported soon, however.

OPTIONS

AUTHOR
Written by numerous people at CMU from 1994 onwards. This manual page by David Huggins-Daines <dhdaines@gmail.com>

COPYRIGHT
Copyright © 1994-2016 Carnegie Mellon University. See the file LICENSE included with this package for more information.

SEE ALSO
pocketsphinx_batch(1), sphinx_fe(1).