I have created this code in order to be able to copy everything that speaks in a text box, but I want it to be able to be done outside the text box.
Here is the code that implements Code:
using System.Windows;
using System.Speech.Synthesis;
using System.Speech.Recognition;
namespace Test
{
public partial class MainWindow : Window
{
PromptBuilder dictado = new PromptBuilder();
SpeechSynthesizer habla = new SpeechSynthesizer();
SpeechRecognitionEngine escucha = new SpeechRecognitionEngine();
string speech;
public MainWindow()
{
InitializeComponent();
ActivarEscucha();
}
private void ActivarEscucha()
{
escucha.SetInputToDefaultAudioDevice();
escucha.LoadGrammar(new DictationGrammar());
escucha.RecognizeAsync(RecognizeMode.Multiple);
escucha.SpeechRecognized += Escucha_SpeechRecognized;
habla.SpeakAsync("Esperando Dictado");
}
private void Escucha_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
speech = e.Result.Text;
// dictado.AppendText(speech);
textbox.AppendText(speech); <-- si yo coloco esta linea, me escribe lo que hable en el textbox, yo necesito es que lo escriba fuera del textbox
}
}
}
I hope you can help me solve this problem, thank you.