1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Speech.Synthesis; //namespace
using System.IO;
namespace SIF
{
public class Falador
{
private static SpeechSynthesizer sp = new SpeechSynthesizer();
public static void Falar(string text)
{
// caso ele esteja falando
if (sp.State == SynthesizerState.Speaking)
sp.SpeakAsyncCancelAll();
sp.SpeakAsync(text);
}
public static void Speak(params string [] texts)
{
Random rnd = new Random();
Speak(texts[rnd.Next(1, texts.Length)]);
}
}
}
This code is for my assistant to choose between several words in C# for example:
Falador.Speak("Tudo bem", "Como desejar");
then he would choose one of those words and speak but the following error happens:
System.Stackoverflowexception: 'Exception of type 'System.Stackoverflowexception' was thrown.'
How can I solve?
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).
– Maniero