11 Replies - 46481 Views - Last Post: 17 May 2013 - 05:28 AM Rate Topic: ***-- 3 Votes

#4 thenganeamol  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 1
  • Joined: 13-April 08

Re: Convert Speech to text and vice-versa in c#.net

Post icon  Posted 10 December 2008 - 04:19 AM

using SpeechLib;
using System.Threading;

private void button1_Click(object sender, EventArgs e)
		{
			if (textBox1.Text != "")
			{
				SpVoice voice = new SpVoice();
				voice.Volume = 100;
				voice.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
				voice.WaitUntilDone(Timeout.Infinite); 
			}
			else
				MessageBox.Show("Please enter text for speech","Text to Speech", MessageBoxButtons.OK,MessageBoxIcon.Information); 
		}




This is the my code. This code only converts Text to Speech but i want opposite of it i.e. How to convert Speech to Text using c#.net.

Please provide me a solution as soon as possible, otherwise it will be too late.

Thanks in advance.
Was This Post Helpful? 1

#5 djkitt  Icon User is offline

  • D.I.C Head

Reputation: 29
  • View blog
  • Posts: 189
  • Joined: 22-May 08

Re: Convert Speech to text and vice-versa in c#.net

Posted 10 December 2008 - 03:09 PM

So,
First you need to add a SpSharedRecoContext object and create an ISpeechRecoGrammar object for it. Then Add a RecognitionHandler to it...

Add another Button and a TextBox to your form and create the objects there. Then add a handler to tie into the listeners Recognition event...
		private void btnListen_Click(object sender, EventArgs e)
		{
			// Speech Recognition Object
			SpSharedRecoContext listener;

			// Grammar object
			ISpeechRecoGrammar grammar;

			listener = new SpeechLib.SpSharedRecoContext();
			listener.Recognition += new _ISpeechRecoContextEvents_RecognitionEventHandler (listener_Reco);
			grammar = listener.CreateGrammar(0);
			grammar.Dictationload("", SpeechLoadOption.SLOStatic);
			grammar.DictationSetState(SpeechRuleState.SGDSActive);
		}

		public void listener_Reco(int StreamNumber, object StreamPosition, SpeechRecognitionType RecognitionType, ISpeechRecoResult Result)
		{
			string heard = Result.PhraseInfo.GetText(0, -1, true);
			textBox1.Text += heard;
		}




Hope this helps,

Kitt
Was This Post Helpful? 1

#6 riteshdembani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-February 09

Re: Convert Speech to text and vice-versa in c#.net

Posted 04 February 2009 - 03:33 AM

Kitt,
I get the exception in the code pasted above. Can you please tell me how to solve the exception

It says: Creating an instance of the COM component with CLSID {47206204-5ECA-11D2-960F-00C04F8EE628} from the IClassFactory failed due to the following error: 8004503a.

Please help me, its very very urgent.
Was This Post Helpful? 0
  • +
  • -

#7 djkitt  Icon User is offline

  • D.I.C Head

Reputation: 29
  • View blog
  • Posts: 189
  • Joined: 22-May 08

Re: Convert Speech to text and vice-versa in c#.net

Posted 10 February 2009 - 03:34 PM

View Postriteshdembani, on 4 Feb, 2009 - 04:33 AM, said:

Kitt,
I get the exception in the code pasted above. Can you please tell me how to solve the exception

It says: Creating an instance of the COM component with CLSID {47206204-5ECA-11D2-960F-00C04F8EE628} from the IClassFactory failed due to the following error: 8004503a.

Please help me, its very very urgent.


Sorry about not replying right away. I have found a post on Microsoft Connect about your issue:
http://connect.micro...edbackID=377678


I am not experinecing the problem, but I am running Vista and it notes the problem is occuring on XP... This was from Oct 2008, and maybe there is a patch?

Hope this helps,

Kitt

This post has been edited by djkitt: 10 February 2009 - 03:39 PM

Was This Post Helpful? 0
  • +
  • -

#8 prajayshetty  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 31
  • View blog
  • Posts: 920
  • Joined: 27-April 07

Re: Convert Speech to text and vice-versa in c#.net

Posted 10 February 2009 - 04:40 PM

wow this is what the one i wanted can you tell me what are the things required to download and ya if you have the link can you post it
Was This Post Helpful? 0
  • +
  • -

#9 saraelgayar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 14-June 09

Re: Convert Speech to text and vice-versa in c#.net

Posted 14 June 2009 - 05:34 AM

View Postprajayshetty, on 10 Feb, 2009 - 03:40 PM, said:

wow this is what the one i wanted can you tell me what are the things required to download and ya if you have the link can you post it


This code works well with windows Form application .. but not with asp.net page .. i dont know why ?.. is there is a reference i have to add it when working with asp.net .. can anybody help me PLZZ ??
Was This Post Helpful? 0
  • +
  • -

#10 abbikhan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 12-November 09

Re: Convert Speech to text and vice-versa in c#.net

Posted 12 November 2009 - 07:29 AM

View Postdjkitt, on 10 Dec, 2008 - 02:09 PM, said:

So,
First you need to add a SpSharedRecoContext object and create an ISpeechRecoGrammar object for it. Then Add a RecognitionHandler to it...

Add another Button and a TextBox to your form and create the objects there. Then add a handler to tie into the listeners Recognition event...
		private void btnListen_Click(object sender, EventArgs e)
		{
			// Speech Recognition Object
			SpSharedRecoContext listener;

			// Grammar object
			ISpeechRecoGrammar grammar;

			listener = new SpeechLib.SpSharedRecoContext();
			listener.Recognition += new _ISpeechRecoContextEvents_RecognitionEventHandler (listener_Reco);
			grammar = listener.CreateGrammar(0);
			grammar.Dictationload("", SpeechLoadOption.SLOStatic);
			grammar.DictationSetState(SpeechRuleState.SGDSActive);
		}

		public void listener_Reco(int StreamNumber, object StreamPosition, SpeechRecognitionType RecognitionType, ISpeechRecoResult Result)
		{
			string heard = Result.PhraseInfo.GetText(0, -1, true);
			textBox1.Text += heard;
		}




Hope this helps,

Kitt

Was This Post Helpful? 0
  • +
  • -

#11 skinayat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 13-April 10

Re: Convert Speech to text and vice-versa in c#.net

Posted 13 April 2010 - 03:09 AM

View Postriteshdembani, on 04 February 2009 - 02:33 AM, said:

Kitt,
I get the exception in the code pasted above. Can you please tell me how to solve the exception

It says: Creating an instance of the COM component with CLSID {47206204-5ECA-11D2-960F-00C04F8EE628} from the IClassFactory failed due to the following error: 8004503a.

Please help me, its very very urgent.



hi,

which reference should i add in my project to get the "using SpeechLib;" libraries

Regards,
S.Inayat Basha
Was This Post Helpful? 0
  • +
  • -

#12 Guest_Saskie*


Reputation:

Re: Convert Speech to text and vice-versa in c#.net

Posted 16 April 2010 - 07:58 AM

Thanks guys. You saved my ass for my 20% project =).

Saskie
Was This Post Helpful? 0

#13 mjamal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-April 10

Re: Convert Speech to text and vice-versa in c#.net

Posted 28 April 2010 - 11:14 PM

View PostSaskie, on 16 April 2010 - 06:58 AM, said:

Thanks guys. You saved my ass for my 20% project =).

Saskie



hi,

i want to convert wave file to Text format. i treid the below code it shows some output , but the words are not the same whats on the wave file, some words are correct and some are not correct.

no the main pbm is when i run the page it just keeps loading and not showing the output. if i put break point only i can able to see the output. What might be the pbm how to solve this?.
am new to this concept i dont know how to solve, i searched a lot for 2 days but cant find any reults.

pls help me out..

the below is the code:
SpeechRecognitionEngine RecognitionEngine;
using (RecognitionEngine = new SpeechRecognitionEngine(new CultureInfo("en-US")))
{
RecognitionEngine.SetInputToWaveFile"D:/wav/test.wav");

//RecognitionEngine.RecognizeCompleted += new EventHandler<RecognizeCompletedEventArgs>(RecognitionEngine_RecognizeCompleted); 
RecognitionEngine.LoadGrammar(new DictationGrammar());
RecognitionResult Result = RecognitionEngine.Recognize();
RecognitionEngine.RecognizeAsync(RecognizeMode.Single);

StringBuilder Output = new StringBuilder();
foreach (RecognizedWordUnit Word in Result.Words)
{
Output.Append(Word.Text + " ");
}

// RecognitionEngine.RecognizeAsyncStop();

lbl_result.Text = Output.ToString();

RecognitionEngine.Dispose();
//Dispose();





i tried using Dispose method also but no use.
how to solve this pbm. And the output should be as it is on the given wave file, is there anyway to get the exact output .

This post has been edited by JackOfAllTrades: 29 April 2010 - 04:27 AM
Reason for edit:: Fixed code tags.

Was This Post Helpful? 0
  • +
  • -

#14 nit.652@rediffmail.com  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 17-May 13

Re: Convert Speech to text and vice-versa in c#.net

Posted 17 May 2013 - 03:45 AM

regards sir/mam, i have completed my major project as text to speech converter , it works with english only but i want it to work with other language also like hindi, french etc. please guide me , so that i can achieve this.
Was This Post Helpful? 0
  • +
  • -

#15 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3621
  • View blog
  • Posts: 11,280
  • Joined: 05-May 12

Re: Convert Speech to text and vice-versa in c#.net

Posted 17 May 2013 - 05:28 AM

Please do not re-open very old threads. Start a new topic instead. Closing this one.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1