Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Process process;

    // Read Contetnt Mouse click event
    private SpeechSynthesizer readerSpeak;
    private void btnSpeakContent_Click(object sender, EventArgs e)
    {
        if(richTextBoxThanglish.Text.Trim() == string.Empty)
        {
            if (process.HasExited == false)
                process.Kill();
            MessageBoxWrapper.ShowWarning("Textbox is Empty.", "ABTS", "Textbox is Empty.");
            process = Process.Start("narrator.exe");
        }
        else
        {
            if (process.HasExited == false)
                process.Kill();

            readerSpeak = new SpeechSynthesizer();                
            readerSpeak.SpeakAsync(richTextBoxThanglish.Text.ToString());

            if (process.HasExited == true)
                process = Process.Start("narrator.exe");
        }
    }       

    private void btnStopSpeak_Click(object sender, EventArgs e)
    {
        if (process.HasExited == true)
            process = Process.Start("narrator.exe");

        if (!(readerSpeak == null))
        {                
            readerSpeak.Dispose();
        }
    }


Assume above program has two buttons call speakContent & stop_speak. I run narrator.exe process to get windows narrator. I do want to speek the richtextbox content without overlapping voice. I know about Synchronos speak, but it will pause my app until speakContent get finish. I need this with SpeakAsyn(). Is there anyway to add silent in the voice narrator? Actually i need that text speech, after 3sec. I had use "System.Threading.Thread.Sleep(3000);". But still text overlapping occurs, Means narrator & string to speech plays together.

Please help.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900