Click here to Skip to main content
16,016,693 members
Please Sign up or sign in to vote.
3.33/5 (3 votes)
See more:
I am trying to design following project which converts "Speech to text"

but it shows following runtime exception:

PlatformNotSupportedException was Unhandled
Speech Recognition is not available on this system. SAPI and Speech Recognition engines cannot be found.

Please suggest me some solution for it.

Code is as under:

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Speech.Recognition;

namespace speech_Recognition
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>


    public partial class Window1 : Window
    {
        private SpeechRecognitionEngine _recognizer = new SpeechRecognitionEngine();

        public Window1()
        {
            InitializeComponent();
        }

        private void button_Rec_Click(object sender, RoutedEventArgs e)
        {
            _recognizer.SetInputToDefaultAudioDevice();
            _recognizer.LoadGrammar(new DictationGrammar());
            _recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(_recognizer_SpeechRecognized);
            _recognizer.RecognizeAsync(RecognizeMode.Multiple);
        }

        void _recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            foreach (RecognizedWordUnit word in e.Result.Words)
            {
                listBox_Results.Items.Add(word.Text);
            }
        }
    }
}


[Edited]Unchecked Ignore HTML tags and entities[/Edited]
Posted
Updated 4-Jul-11 7:00am
v2

1 solution

You need the speech sdk[^].
 
Share this answer
 
Comments
djrocks0101 4-Jul-11 13:28pm    
thanks
thatraja 4-Jul-11 13:34pm    
Hi, Did you vote him? If yes then let me tell you something....For good answers you may vote 4 or 5 & you may accept the answer(The green button).
Raaj_007 4-Jul-11 14:49pm    
Abhinav S: my5
djrocks0101 5-Jul-11 1:10am    
Now I am using microsoft speech SDK, but now I'm getting a new exception
in this line of code:

_recognizer.SetInputToDefaultAudioDevice();

and exception is as show below:

ArgumentException was Unhandled
Value does not fall within the expected range.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900