.NET C# Text to Speach
Notes:
- Add a new reference: COM -> Microsoft Speach Object Library
- Add a textbox and button to your forms
- Import SpeechLib
Code:
Code (Text):
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SpeechLib;
namespace TextSpeach
{
public partial class Form1 : Form
{
SpVoice voice = new SpVoice();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
voice.Speak(textBox1.Text.ToString());
}
}
}
0 comments