Sunday, September 18, 2011

"Make your computer to speak what you write in Textbox" application in asp.net

Download Aspnetaudio setup from
www.aspnetaudio.com/aspnetaudio_Download.aspx


Import .dll file into your application


Now start with application


In .aspx page



<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>


<%@ Register assembly="ASPNetAudio.NET3" namespace="ASPNetAudio" tagprefix="ASPNetAudio" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


         <asp:TextBox ID="TextBox1" runat="server" Height="152px" TextMode="MultiLine" 
          
  Width="216px"></asp:TextBox>
  


    <asp:Button ID="Btnplay" runat="server" onclick="Btnplay_Click" Text="speak" />
    
<ASPNetAudio:Audio ID="Audio1" runat="server" 
        AudioURL="YouTube - kalyug - Jiya dhadak dhadak.mp3">
    </ASPNetAudio:Audio>

   <p>
        &nbsp;</p>
    <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="play" />
  


In code behind file

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SpeechLib;
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Btnplay_Click(object sender, EventArgs e)
    {
        SpVoice voice = new SpVoice();
        string s=TextBox1.Text;
        voice.Speak(TextBox1.Text, 0);
        voice.Rate = 10;
    }
  
}

No comments:

Post a Comment