Using windows inbuild speaking service Convert Text to Voice


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. Find Whole project in Attachment 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());
}
}
}


Comments

No responses found. Be the first to 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:
    Email: