8

Is there some command line utility of pocket sphinx or cmu sphinx to convert a .wav file to text?

pocketsphinx_continuous -hmm -lm -dict will do. But I don't want to keep speaking the same sentence again and again.

nizam.sp
  • 4,002
  • 5
  • 39
  • 63

1 Answers1

10

pocketsphinx_continuous starting from version 0.8 has option -infile which you can use to decode a file. File must be in a specific format: 16khz 16bit mono wav file

 pocketsphinx_continuous -infile file.wav
Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
  • Thanks for your answer. I don't see this -infile argument in man file. Moreover, I get the following error. FATAL_ERROR: "continuous.c", line 153: Failed to calibrate voice activity detection. I have the input file in 8k sample rate. Is that the problem? – nizam.sp Dec 07 '13 at 15:31
  • 1
    Yes, if you want to decode 8khz audio file you need to add an option '-samprate 8000'. Also make sure you are using the correct acoustic model for the audio you are trying to decode. – Nikolay Shmyrev Dec 07 '13 at 20:43
  • 2
    Even with -samprate 8000, i get the same error :( "FATAL_ERROR: "continuous.c", line 153: Failed to calibrate voice activity detection" – nizam.sp Dec 07 '13 at 20:51
  • share the file you are trying to recognize – Nikolay Shmyrev Dec 07 '13 at 22:06
  • 2
    I had this same problem, and it was solved by creating a larger file, with more silence at the beginning. From what I read in the Sphinx code, it seems that this calibration process is to calibrate what is silence and what isn't. Since I had a very small audio file (only three words, about a second), I deduced it needs more data to "calibrate" the silence. – Rafael Almeida Feb 14 '14 at 16:33
  • In recent versions this issue was fixed, you don't need to add silence anymore. – Nikolay Shmyrev Feb 15 '14 at 09:43
  • This hasn't worked for a long time. You need to specify an acoustic model. – Cerin Apr 27 '16 at 21:45
  • If models are properly installed, you do not need to specify the model path on Linux. On Windows you always need to specify the path since there is no "installation" step there. – Nikolay Shmyrev Apr 28 '16 at 06:51