Subscribe to Subscribers

Online Members

Shahbaz Ahmed
More...

Resources » Code Snippets » Windows Services

Speaking Computer


Posted Date:     Category: Windows Services    
Author: Member Level: Gold    Points: 3


I have an application in which you just enter some text into the textbox and adjust you headphone or speakers to listen to that text. you can convert the text into voice. this code is using windows inbuild speking service.



Form1.cs


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SpeechLib;

namespace SpeakingComputer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
SpVoice voice = new SpVoice();
voice.Speak(txtText.Text, SpeechVoiceSpeakFlags.SVSFDefault);
}
}
}



Form1.Designer.cs

namespace SpeakingComputer
{
partial class Form1
{
///
/// Required designer variable.
///

private System.ComponentModel.IContainer components = null;

///
/// Clean up any resources being used.
///

/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.btnSpeak = new System.Windows.Forms.Button();
this.txtText = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btnSpeak
//
this.btnSpeak.Location = new System.Drawing.Point(87, 247);
this.btnSpeak.Name = "btnSpeak";
this.btnSpeak.Size = new System.Drawing.Size(75, 23);
this.btnSpeak.TabIndex = 0;
this.btnSpeak.Text = "Speak";
this.btnSpeak.UseVisualStyleBackColor = true;
this.btnSpeak.Click += new System.EventHandler(this.button1_Click);
//
// txtText
//
this.txtText.Location = new System.Drawing.Point(12, 12);
this.txtText.Multiline = true;
this.txtText.Name = "txtText";
this.txtText.Size = new System.Drawing.Size(268, 229);
this.txtText.TabIndex = 1;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.txtText);
this.Controls.Add(this.btnSpeak);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Button btnSpeak;
private System.Windows.Forms.TextBox txtText;
}
}

Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace SpeakingComputer
{
static class Program
{
///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}






Did you like this resource? Share it with your friends and show your love!


Responses to "Speaking Computer"
Author: santosh    24 Sep 2010Member Level: Silver   Points : 1
hi Dharmendra Kumar

is it will work in visual studio 2005???


Regards
Santosh



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Compress and Decompress File
    Previous Resource: Hosting the WCF Service
    Return to Resources
    Post New Resource
    Category: Windows Services


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Speaking computer  .  Text to speech  .  

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2013 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.