4

I am trying to design a text editor using C# language and implement voice recognition for the normal file features , is this possible to implement. I am very sorry if I am repeating the question which has been asked previously. I just want to know if there are ways in converting the Speech to Text using C#. Your help is really valuable . Awaiting for response. Thanks in advance.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
ArunKumar
  • 41
  • 1
  • 2
  • 1
    welcome to stack overflow. as of now its not that accurate. please read [Whatever Happened to Voice Recognition?](http://www.codinghorror.com/blog/2010/06/whatever-happened-to-voice-recognition.html) – naveen Jul 04 '11 at 09:45

5 Answers5

3

Here is a complete example using C# and System.Speech for converting from speech to text

The code can be divided into 2 main parts:

configuring the SpeechRecognitionEngine object (and its required elements) handling the SpeechRecognized and SpeechHypothesized events.

Step 1: Configuring the SpeechRecognitionEngine

_speechRecognitionEngine = new SpeechRecognitionEngine();
_speechRecognitionEngine.SetInputToDefaultAudioDevice();
_dictationGrammar = new DictationGrammar();
_speechRecognitionEngine.LoadGrammar(_dictationGrammar);
_speechRecognitionEngine.RecognizeAsync(RecognizeMode.Multiple);

At this point your object is ready to start transcribing audio from the microphone. You need to handle some events though, in order to actually get access to the results.

Step 2: Handling the SpeechRecognitionEngine Events

_speechRecognitionEngine.SpeechRecognized -= new EventHandler(SpeechRecognized); _speechRecognitionEngine.SpeechHypothesized -= new EventHandler(SpeechHypothesizing);

_speechRecognitionEngine.SpeechRecognized += new EventHandler(SpeechRecognized); _speechRecognitionEngine.SpeechHypothesized += new EventHandler(SpeechHypothesizing);

private void SpeechHypothesizing(object sender, SpeechHypothesizedEventArgs e) { ///real-time results from the engine string realTimeResults = e.Result.Text; }

private void SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { ///final answer from the engine string finalAnswer = e.Result.Text; }

That’s it. If you want to use a pre-recorded .wav file instead of a microphone, you would use

_speechRecognitionEngine.SetInputToWaveFile(pathToTargetWavFile);

instead of

_speechRecognitionEngine.SetInputToDefaultAudioDevice();

There are a bunch of different options in these classes and they are worth exploring in more detail.

http://ellismis.com/2012/03/17/converting-or-transcribing-audio-to-text-using-c-and-net-system-speech/

bulltorious
  • 7,769
  • 4
  • 49
  • 78
2

You can use try SharpSphinx A C# version of Sphinx-4 http://sourceforge.net/p/cmusphinx/discussion/sphinx4-sightings/thread/5953c635/?limit=50

1

If I recall correctly the Microsoft Speech SDK supports speech to text.

Ostemar
  • 5,778
  • 2
  • 19
  • 16
1

Then there's the LumenVox Speech Engine.

Ola Eldøy
  • 5,720
  • 7
  • 49
  • 82
0

There's also the iSpeech API, which could be used for speech recognition as a web service.

Ola Eldøy
  • 5,720
  • 7
  • 49
  • 82