Friday 27 July 2012

To Create a text To Voice Application in Asp.Net


To Create a text  To Voice Application

means : the contains which i write into the text field the  system will speak it...............

Frist we take a asp.net page after then add reference Microsoft  Speech Object Library 5.4  then take  a text box  and  button  when  i write any text in textbox system will speak it...............








using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using SpeechLib;

public partial class _Default : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {


    }


    protected void btnspeak_Click(object sender, EventArgs e)

    {

        SpVoice voice = new SpVoice();


        SpeechVoiceSpeakFlags spflag = SpeechVoiceSpeakFlags.SVSFlagsAsync;

        voice.Speak(TextBox1.Text, spflag);


    }

    This is  code for  system will speak  each letter of sentence means this  types concept use in     cepcha concept

    protected void btnspeakonebyone_Click(object sender, EventArgs e)
         
     {
        SpVoice voice = new SpVoice();

        SpeechVoiceSpeakFlags spflag = SpeechVoiceSpeakFlags.SVSFlagsAsync;

        foreach (char c in TextBox1.Text.ToCharArray())
        {

                voice.Speak(c.ToString(), spflag);
        }

      
    }




}


After than you check it




1 comments: