Edit for clarity: The output I get from sphinx is not even close to the actual words in my sound file. What do I need to do to make it more accurate?
Here's the file I'm trying to get a transcript from. It should be at a sample rate of 8K.
The speech in the file is "What should you do if you experience a problem with your iPod", but as output, I get:
<s> <sil> well how how [um] [cough] [um] old [cough] [noise] [cough] <sil> [noise]
[um] <sil> [um] <sil> [uh] [cough] [noise] [cough] [um]
Here's my code:
package com.test.sphinxtest;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import edu.cmu.sphinx.api.Configuration;
import edu.cmu.sphinx.api.LiveSpeechRecognizer;
import edu.cmu.sphinx.api.SpeechResult;
import edu.cmu.sphinx.api.StreamSpeechRecognizer;
public class App
{
public static void main( String[] args )
{
Configuration configuration = new Configuration();
configuration.setAcousticModelPath("models/acousticmodel/en-us-8khz");
configuration.setDictionaryPath("dictionary/cmudict-0.6d");
configuration.setLanguageModelPath("models/languagemodel/en-us.lm");
configuration.setSampleRate(8000);
try {
StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(configuration);
recognizer.startRecognition(new FileInputStream("speech/speech8k.wav"));
System.out.println("Starting recognition");
SpeechResult result = recognizer.getResult();
System.out.println("Stopping recognition");
recognizer.stopRecognition();
System.out.println("number of words " + result.getWords().size());
for(int i=0;i<result.getWords().size();i++){
System.out.println(result.getWords().get(i).getWord());
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
I looked at this page: http://cmusphinx.sourceforge.net/wiki/faq#qwhy_my_accuracy_is_poor
And I saw that I had to set my audio file to be single-channel.
After I did that, I got a reasonable output.