コード例 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            synth.Speak("Bienvenido al diseño de interfaces avanzadas. Inicializando la Aplicación");

            Grammar grammar  = CreateGrammarBuilderRGBSemantics2(null);
            Grammar grammar2 = CreateGrammarBuilderTimeSemantics2(null);
            Grammar grammar3 = CreateGrammarBuilderRemoveSemantics2(null);
            Grammar grammar4 = CreateGrammarBuilderTextSemantics2(null);

            _recognizer.SetInputToDefaultAudioDevice();
            _recognizer.UnloadAllGrammars();
            // Nivel de confianza del reconocimiento 70%
            _recognizer.UpdateRecognizerSetting("CFGConfidenceRejectionThreshold", 50);
            grammar.Enabled  = true;
            grammar2.Enabled = true;
            grammar3.Enabled = true;
            grammar4.Enabled = true;
            _recognizer.LoadGrammar(grammar);
            _recognizer.LoadGrammar(grammar2);
            _recognizer.LoadGrammar(grammar3);
            _recognizer.LoadGrammar(grammar4);
            _recognizer.SpeechRecognized += new EventHandler <SpeechRecognizedEventArgs>(_recognizer_SpeechRecognized);
            //reconocimiento asíncrono y múltiples veces
            _recognizer.RecognizeAsync(RecognizeMode.Multiple);
            synth.Speak("Aplicación preparada para reconocer su voz");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: saveenr/saveenr
        private static void wreck_a_nice_beach()
        {
            var sre = new SSR.SpeechRecognitionEngine();
            sre.SetInputToDefaultAudioDevice();
            sre.UnloadAllGrammars();

            var gb1 = new SSR.GrammarBuilder();
            gb1.Append(new SSR.Choices("cut", "copy", "paste", "delete", "quit"));


            var g1 = new SSR.Grammar(gb1);
            sre.LoadGrammar(g1);

            sre.SpeechRecognized += SreOnSpeechRecognized;
            sre.SpeechDetected += SreOnSpeechDetected;
            sre.SpeechHypothesized += SreOnSpeechHypothesized;
            sre.SpeechRecognitionRejected += SreOnSpeechRecognitionRejected;
            sre.AudioSignalProblemOccurred += SreOnAudioSignalProblemOccurred;

            sre.RecognizeAsync(SSR.RecognizeMode.Multiple);
        }
コード例 #3
0
        private void loadGrammar()
        {
            sre.UnloadAllGrammars();
            htWords.Clear();
            StreamReader sr   = File.OpenText(strGrammarFile);
            int          icnt = 0;

            while (!sr.EndOfStream && icnt < 10000)
            {
                string strLine = sr.ReadLine();
                if (strLine != "")
                {
                    SSR.GrammarBuilder gb = new System.Speech.Recognition.GrammarBuilder();
                    gb.Append(strLine);
                    SSR.Grammar gram = new System.Speech.Recognition.Grammar(gb);
                    sre.LoadGrammar(gram);

                    htWords.Add(htWords.Count, strLine.ToLower());
                }
                icnt++;
            }
        }
コード例 #4
0
        private static void wreck_a_nice_beach()
        {
            var sre = new SSR.SpeechRecognitionEngine();

            sre.SetInputToDefaultAudioDevice();
            sre.UnloadAllGrammars();

            var gb1 = new SSR.GrammarBuilder();

            gb1.Append(new SSR.Choices("cut", "copy", "paste", "delete", "quit"));


            var g1 = new SSR.Grammar(gb1);

            sre.LoadGrammar(g1);

            sre.SpeechRecognized           += SreOnSpeechRecognized;
            sre.SpeechDetected             += SreOnSpeechDetected;
            sre.SpeechHypothesized         += SreOnSpeechHypothesized;
            sre.SpeechRecognitionRejected  += SreOnSpeechRecognitionRejected;
            sre.AudioSignalProblemOccurred += SreOnAudioSignalProblemOccurred;

            sre.RecognizeAsync(SSR.RecognizeMode.Multiple);
        }