2

Possible Duplicate:
speech recognition from audio file instead of microphone

I have this program which does speech recognition using the microphone device. Here is a short snippet from the program that does so.

However, what I intend to do is instead of using the microsophone device, I intend to pass a sound file to this speech recognition engine, which in trun should recognize the text from that aduio file and retun the result.

    SpeechRecognitionEngine speechRecognitionEngine = new SpeechRecognitionEngine();
    List<Word> words = new List<Word>();
    public TestSpeech()
    {
        speechRecognitionEngine = createSpeechEngine("en-us");
        speechRecognitionEngine.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(engine_SpeechRecognized);
        loadGrammarAndCommands();            

        speechRecognitionEngine.SetInputToDefaultAudioDevice();
        speechRecognitionEngine.RecognizeAsync(RecognizeMode.Multiple);
    }

What should I do instead of speechRecognitionEngine.SetInputToDefaultAudioDevice();?

Speech to recognition desktop sample for recognition from audio device: http://www.codeproject.com/Articles/380027/Csharp-Speech-to-Text

Community
  • 1
  • 1
user1372448
  • 427
  • 2
  • 12
  • 22

2 Answers2

3

Why not try SetInputToAudioStream()?

Charlie Salts
  • 13,109
  • 7
  • 49
  • 78
0

Solution:

You should configure the input mode to be wav:

// Configure the input to the recognizer.
recognizer.SetInputToWaveFile(@"c:\temp\SampleWAVInput.wav");

This article discusses how to recognize audio files with the recognizer in the System.Speech namespace.

Other notes:

  1. You will need to make sure your audio files are in correct/supported formats
  2. You should also check out the Microsoft Speech Platform 11 (latest version as of post). It has the latest Microsoft Speech Technology which might improve accuracy for whatever you are trying to do.

You can read more here and download SDK by doing a Google Search for "Microsoft Speech Platform SDK 11 Download"

Good Luck!

Matthias
  • 7,432
  • 6
  • 55
  • 88