POCKETSPHINX(1)
π NAME π
pocketsphinx β run speech recognition on audio data. That's the whole gig, bestie. π€β¨
This is the POCKETSPHINX(1) page, straight outta the General Commands Manual. Pocketsphinx said "name so nice u write it twice" so the og header had it on both ends, but we're folding it up here at the top where it belongs. π«Ά
π SYNOPSIS π
pocketsphinx [ options... ] [ live | single | help | soxflags ]
INPUTS...
π¦ DESCRIPTION π¦
okay so picture this: the pocketsphinx command-line program reads single-channel 16-bit PCM audio from one or more input files β or from - if u want it slurping straight off standard input π₯€ β and then it goes and tries to recognize speech in that audio using the default acoustic and language model. It's giving main character energy fr fr.
Those input files can be raw audio, WAV, or NIST Sphere files β tho ngl some of these may not get recognized properly, so don't come for me if ur crusty old file gets ignored. π
It also takes a large number of options which you probably don't care about, plus a command, which defaults to live if u don't say anything. Iconic lazy-girl behavior, we respect it.
Here's the rundown of the commands, bestie:
helpβ print a long list of those options you don't care about. Yes, that's literally the description. Slay.configβ dump the configuration as JSON to standard output. Bonus: u can load it right back in with the-configoption. β»οΈliveβ detect speech segments in the input files, run recognition on them (using all those options u don't care about), and write the results to standard output as line-delimited JSON. I know, it's not the prettiest format ever, but honestly it sure beats XML. π
Every line is a JSON object with these fields, which got short names purely so the lines stay readable:
"b"β start time in seconds, counted from the beginning of the stream β±οΈ"d"β duration in seconds"p"β estimated probability of the recognition result, i.e. a number between0and1which u may use as a confidence score"t"β full text of the recognition result"w"β list of segments (usually words), each of which in turn contains theb,d,p, andtfields, for start, end, probability, and the text of the word. In the future we may also support hierarchical results, in which casewcould be present.
singleβ recognize the input as a single utterance, and write a JSON object in the same format described above. One shot, one vibe. π―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 the subsequent ones get concatenated to make the text β that way there are no surprises if u forget to quote it. And bestie, you are responsible for normalizing the text to remove punctuation, uppercase, centipedes, etc. (yes. centipedes. that's what it says. we don't make the rules π)
For example:
pocketsphinx align goforward.wav "go forward ten meters"
By default, only word-level alignment happens. If u want phone alignments, pass -phone_align yes in the flags, like:
pocketsphinx -phone_align yes align audio.wav $text
And to get state-level alignments, pass -state_align yes β heads up, that automatically enables phone alignment as well:
pocketsphinx -state_align yes align audio.wav $text
This will make not particularly readable output, but u can use jq (https://stedolan.github.io/jq/) to clean it up. For example, u can get just the word names and start times like this:
pocketsphinx align audio.wav $text | jq '.w[]|[.t,.b]'
Or u 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. Go wild. π
helpβ print a usage and help text with a list of possible arguments. Yes,helpshows up twice in this list, mind ur business. π U can also get command-specific help by specifying a command after help β for example,pocketsphinx help alignwill show u the alignment-specific options. Chef's kiss. πhelp-configβ print a long list of all configuration parameters with their descriptions. This is the deep lore for the config girlies.soxflagsβ return arguments tosoxwhich will create the appropriate input format. But β οΈ note that because thesoxcommand-line is slightly quirky, these must always come after the filename or-d(and-dis what tellssoxto read from the microphone, iykyk). ποΈ
U 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 get printed to standard error. If u want more info, pass -loglevel INFO and it will spill the tea. β
Also: partial results are not printed. Maybe they will be in the future, but bestie, don't hold ur breath. π Force-alignment, however, is likely to be supported soon. β¨
β‘ OPTIONS β‘
okay bestie, this is the part where we go through EVERY. SINGLE. FLAG. no skipping, no gatekeeping, we're doing the whole list π each one comes before the audio files on the command line, iykyk.
-agcβ automatic gain control forc0, and your choices are'max','emax','noise', or'none'β¨-agcthreshβ the initial threshold for that automatic gain control-allphoneβ phoneme decoding with a phonetic lm (and yeah, you hand it the file right here)-allphone_ciβ do the phoneme decoding with a phonetic lm but context-independent units only, no context drama π-alphaβ preemphasis parameter-ascaleβ inverse of the acoustic model scale, used for confidence score calculation-awβ inverse weight applied to acoustic scores-backtraceβ print results AND backtraces to the log π-beamβ beam width applied to every frame in the Viterbi search (heads up: smaller values mean a wider beam, yes it's giving backwards, that's just how it is)-bestpathβ run the bestpath (Dijkstra) search over the word lattice β that's the 3rd pass π-bestpathlwβ language model probability weight for the bestpath search-ceplenβ number of components in the input feature vector-cmnβ cepstral mean normalization scheme, pick'live','batch', or'none'-cmninitβ initial values (comma-separated, bestie) for the cepstral mean when'live'is the scheme in use-compallsenβ compute all senone scores in every frame (this can genuinely be faster when there are a lot of senones, slay)-dictβ pronunciation dictionary (lexicon) input file-dictcaseβ dictionary is case sensitive (β οΈ NOTE: the case insensitivity applies to ASCII characters only)-ditherβ add 1/2-bit noise-doublebwβ use double bandwidth filters (same center freq, just chonkier)-dsβ frame GMM computation downsampling ratio-fdictβ word pronunciation dictionary input file-featβ feature stream type, depends on the acoustic model-featparamsβ containing feature extraction parameters.-fillprobβ filler word transition probability-frateβ frame rate-fsgβ format finite state grammar file-fsgusealtpronβ add alternate pronunciations to the FSG-fsgusefillerβ insert filler words at each state.-fwdflatβ run the forward flat-lexicon search over the word lattice β that's the 2nd pass β¨-fwdflatbeamβ beam width applied to every frame in the second-pass flat search-fwdflatefwidβ minimum number of end frames for a word to be searched in the fwdflat search-fwdflatlwβ language model probability weight for flat lexicon (2nd pass) decoding-fwdflatsfwinβ window of frames in the lattice to search for successor words in the fwdflat search-fwdflatwbeamβ beam width applied to word exits in the second-pass flat search-fwdtreeβ run the forward lexicon-tree search β that's the 1st pass, the og π-hmmβ containing acoustic model files.-input_endianβ endianness of the input data, big or little, ignored if it's NIST or MS Wav-jsgfβ grammar file-keyphraseβ to spot-kwsβ file with keyphrases to spot, one per line-kws_delayβ delay to wait for the best detection score-kws_plpβ phone loop probability for keyphrase spotting-kws_thresholdβ threshold for thep(hyp)/p(alternatives)ratio-latsizeβ initial backpointer table size-ldaβ containing transformation matrix to be applied to features (single-stream features only, don't try it with anything else)-ldadimβ dimensionality of the output of the feature transformation (0means use the entire matrix)-lifterβ length of the sin-curve for liftering, or0for no liftering.-lmβ trigram language model input file-lmctlβ a set of language model-lmnameβ language model in-lmctlto use by default-logbaseβ base in which all log-likelihoods are calculated-logfnβ to write log messages in-loglevelβ minimum level of log messages (DEBUG,INFO,WARN,ERROR)-logspecβ write out logspectral files instead of cepstra-lowerfβ lower edge of filters-lpbeamβ beam width applied to the last phone in words-lponlybeamβ beam width applied to the last phone in single-phone words-lwβ language model probability weight-maxhmmpfβ maximum number of active HMMs to maintain at each frame (or-1for no pruning)-maxwpfβ maximum number of distinct word exits at each frame (or-1for no pruning)-mdefβ definition input file-meanβ gaussian means input file-mfclogdirβ to log feature files to-min_endfrβ nodes ignored in lattice construction if they persist for fewer than N frames-mixwβ mixture weights input file (uncompressed)-mixwfloorβ senone mixture weights floor (applied to data from the-mixwfile)-mllrβ transformation to apply to means and variances-mmapβ use memory-mapped I/O (if possible) for model files-ncepβ number of cep coefficients-nfftβ size of the FFT, or0to set it automatically (recommended, fr fr trust)-nfiltβ number of filter banks-nwpenβ new word transition penalty-pbeamβ beam width applied to phone transitions-pipβ phone insertion penalty-pl_beamβ beam width applied to phone loop search for lookahead-pl_pbeamβ beam width applied to phone loop transitions for lookahead-pl_pipβ phone insertion penalty for phone loop-pl_weightβ weight for phoneme lookahead penalties-pl_windowβ phoneme lookahead window size, in frames-rawlogdirβ to log raw audio files to-remove_dcβ remove DC offset from each frame-remove_noiseβ remove noise using spectral subtraction-round_filtersβ round mel filter frequencies to DFT points-samprateβ sampling rate-seedβ seed for the random number generator; if it's less than zero, we pick our own π²-sendumpβ dump (compressed mixture weights) input file-senlogdirβ to log senone score files to-senmgauβ to codebook mapping input file (usually not needed)-silprobβ silence word transition probability-smoothspecβ write out cepstral-smoothed logspectral files-svspecβ specification (e.g.,24,0-11/25,12-23/26-38or0-12/13-25/26-38)-tmatβ state transition matrix input file-tmatfloorβ HMM state transition probability floor (applied to the-tmatfile)-topnβ maximum number of top Gaussians to use in scoring.-topn_beamβ beam width used to determine top-N Gaussians (or a list, per-feature π«Ά)-topruleβ rule for JSGF (first public rule is the default)-transformβ which type of transform to use to calculate cepstra (legacy,dct, orhtk)-unit_areaβ normalize mel filters to unit area-upperfβ upper edge of filters-uwβ unigram weight-varβ gaussian variances input file-varfloorβ mixture gaussian variance floor (applied to data from the-varfile)-varnormβ variance normalize each utterance (only if CMN == current, no exceptions bestie)-verboseβ show input filenames-warp_paramsβ defining the warping function-warp_typeβ warping function type (or shape)-wbeamβ beam width applied to word exits-wipβ word insertion penalty-wlenβ Hamming window length
π 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 π¦
okay that's the whole page, you made it, I'm so proud of you π₯Ήπ this was the POCKETSPHINX(1) page, stamped with the date 2022-09-27 β go forth and decode some speech, you absolute icon π β¨
π¦ where this page comes from
- nixpkgs unstable: pocketsphinx 5.1.1
- ubuntu stonking: pocketsphinx 5.1.1-1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms