Speech to Text Conversion using asp.net and C#
Hi I have created a basic Speech to text conversion window form.
For this we need to first download the sapi(Speech Software Development Kit). One site for downloading is http://www.microsoft.com/download/en/details.aspx?id=10121
Incase using visual studio 2005 also download System.Speech.Recognition dll from the net.
Once you have downloaded the dll, go to http://msdn.microsoft.com/en-us/library/system.speech.recognition.aspx to understand then System.Speech.Recognition Namespace
Otherwise in google just type sapi download. Add this to your project and then the code as follows :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SpeechLib;
using System.Speech.Recognition;
using System.Globalization;
using System.Threading;
using System.Diagnostics;
Hi I have created a basic Speech to text conversion window form.
For this we need to first download the sapi(Speech Software Development Kit). One site for downloading is http://www.microsoft.com/download/en/details.aspx?id=10121
Incase using visual studio 2005 also download System.Speech.Recognition dll from the net.
Once you have downloaded the dll, go to http://msdn.microsoft.com/en-us/library/system.speech.recognition.aspx to understand then System.Speech.Recognition Namespace
Otherwise in google just type sapi download. Add this to your project and then the code as follows :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SpeechLib;
using System.Speech.Recognition;
using System.Globalization;
using System.Threading;
using System.Diagnostics;
namespace
SpeechToText
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void button1_Click(object
sender, EventArgs e)
{
SpeechRecognitionEngine
recognizer = new SpeechRecognitionEngine();
Grammar
dictationGrammar = new DictationGrammar();
recognizer.LoadGrammar(dictationGrammar);
try
{
button1.Text = "Speak
Now";
recognizer.SetInputToDefaultAudioDevice();
RecognitionResult
result = recognizer.Recognize();
string
output = result.Text;
TextBox1.Text = output;
button1.Text = "Speak";
}
catch
(InvalidOperationException exception)
{
TextBox1.Text = String.Format("Could
not recognize input from default aduio device. Is a microphone or sound card
available?\r\n{0} - {1}.", exception.Source, exception.Message);
}
finally
{
recognizer.UnloadAllGrammars();
}
}
}
}
No comments:
Post a Comment