views:

72

answers:

2

hello, i'm new to C# and i'm new to Speech.Recognition. i searched very long for tutorials but didn't find that much. (i'm even not quiet sure wheater i included everything correctly)

i downloaded: SDK: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=1b1604d3-4f66-4241-9a21-90a294a5c9a4&displaylang=en

Runtime: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=bb0f72cb-b86b-46d1-bf06-665895a313c7&displaylang=en

Languages: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=47ffd4e5-e682-4228-8058-dd895252a3c3&displaylang=en

i'm programming local, i have windows XP, .net framework 3.5.

now i just want to get started with some simple lines of code, like to say "hello world" or say one or two words as input.

i tried following, and of course it doesn't work :> error:

~"The Typ- or Namespacename "SpeechSynthesizer" couldn't be found (Is a Using-Direktive or a Assemblyverweis missing?)"

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Recognition;
using System.Speech.Synthesis;


namespace System.Speech.Recognition { }
namespace System.Speech.AudioFormat {}
namespace System.Speech.Recognition.SrgsGrammar{}
namespace System.Speech.Synthesis { }
namespace System.Speech.Synthesis.TtsEngine { }

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {



            SpeechSynthesizer foo = new SpeechSynthesizer();
            foo.Speak("Test");  


        }
    }
}

would be very happy for some help :> thanks

edit:

hello, i tried you code,but using SpeechLib; couldn't be found :>

well now i wrote:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Recognition;
using System.Speech.Synthesis;
using System.SpeechLib;

namespace System.SpeechLib { }
namespace System.Speech.Recognition { }
namespace System.Speech.AudioFormat {}
namespace System.Speech.Recognition.SrgsGrammar{}
namespace System.Speech.Synthesis { }
namespace System.Speech.Synthesis.TtsEngine { }

but i get an error with: numericUpDown1,SpVoice,SpeechVoiceSpeakFlags,textBox1 and Timeout

A: 

you can try this:

get Interop.SpeechLib.dll

using SpeechLib;

private void ReadText(string readText)
        {
            int iCounter = 0;
            while (Convert.ToInt32(numericUpDown1.Value) > iCounter)
            {
                SpVoice spVoice = new SpVoice();
                spVoice.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak);
                spVoice.WaitUntilDone(Timeout.Infinite);
                iCounter = iCounter + 1;
            }
        }
anishmarokey
+2  A: 

Project + Add Reference, .NET tab, select "System.Speech".

A project template pre-selects several .NET assemblies. But only common ones, like System.dll, System.Core.dll, etcetera. You have to add the 'unusual' ones yourself.

Hans Passant
+1. `Using` is just creating shortcuts to the namespaces. To use them you need to link assemblies to the project.
Mike
thank you, i took system.speech and now it works! greate - ( do you know how i switch to the german language?)
Tyzak
Yes, three years of German in high school helped. But I don't think you'll get it on a Windows machine unless the Windows version is German. Not sure what is required, money no doubt. Start another question about that at superuser.com
Hans Passant