Speech örneğinde sıkıntı var

Bu konuyu okuyanlar

ibrahim591

Öğrenci
Katılım
27 Nisan 2019
Mesajlar
40
Reaksiyon puanı
2
Puanları
8
Yaş
18
System.InvalidOperationException' türünde bir yakalanamayan özel durum, System.Speech.dll öğesinde oluştu.

***************************************************************************************************************************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Speech.Recognition;
using System.Speech.Synthesis;
using System.Media;
using System.Diagnostics;

namespace CervisTr
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private static SpeechSynthesizer synth = new SpeechSynthesizer();
private static SpeechRecognitionEngine engine = new SpeechRecognitionEngine();
private void Form2_Load(object sender, EventArgs e)
{

}

void SesCervis()
{

Choices chan = new Choices();

chan.Add(new string[] { "Hey" });

GrammarBuilder gra = new GrammarBuilder();
gra.Append(chan);
Grammar grammar = new Grammar(gra);

engine.LoadGrammarAsync(grammar);

engine.SetInputToDefaultAudioDevice();
engine.SpeechRecognized += sesalgı;

}

private void sesalgı(object sender, SpeechRecognizedEventArgs e)
{

// if(e.Result.Text == "Hey")
// {
// SoundPlayer bip = new SoundPlayer(@"C:/Users/ibrah/Desktop/sesler/bip.wav");
// bip.Play();
// webBrowser1.Document.GetElementById("gt-speech").InvokeMember("click");
// timer1.Start();
// }


switch (e.Result.Text)
{

case "Hey":
MessageBox.Show("merhaba");
break;
}

}

private void timer1_Tick(object sender, EventArgs e)
{
if (webBrowser1.Document.GetElementById("source").InnerText == "Google'ı aç")
{
ProcessStartInfo google = new ProcessStartInfo();
google.FileName = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe";
Process.Start(google);
timer1.Stop();
}
}

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
engine.RecognizeAsync(RecognizeMode.Multiple);
}
}
}

**************************************************************************************************************************************

CervisTr.exe Information: 0 : SAPI does not implement phonetic alphabet selection.
System.InvalidOperationException üzerinde 'System.Speech.dll' türünde bir özel durum oluştu
'System.InvalidOperationException' türünde bir yakalanamayan özel durum, System.Speech.dll öğesinde oluştu
At least one grammar must be loaded before doing a recognition.

'CervisTr.exe' (CLR v4.0.30319: CervisTr.exe): 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\PrivateAssemblies\Runtime\Microsoft.VisualStudio.Debugger.Runtime.dll' yüklendi. Sembollerin yüklemesi atlandı. Modül iyileştirildi ve hata ayıklayıcının 'Yalnızca Kendi Kodum' seçeneği etkin hale getirildi.
'[8412] CervisTr.exe' programı -1 (0xffffffff) koduyla çıktı.



lütfen yardım edin
 
Üst