Speech Translation in C#


Speech Translation is used for translate text to voice. Basically speech translation is used in profile registration as like confirmation number / Enter Above Shown number, you can see beside of that speaker icon.....that nothing but a speech translation..

Speech Translation is used to convert text to speech or voice.This makes us to listen a voice from the speakers that reads some specified text. For these we need a library to develop a speech translation.

Library Name is : System.Speech.Synthesis.SpeechSynthesizer;

This Library contain predefined class speechsynthesizer by using this class to convert the required text through the speakers.

Follow this step to Add SpeechSynthesizer Reference

Step :1
=======
Open visual Studio --> Expand Project ---> Click on Add Reference...

Step :2
=======
Open Add Reference ---> LeftPanel Expand Assemblies ---> Select Framework --->
in Center Panel Find System.Speech Library ---> Select or Checked ---> Ok.


Syntax:
======

--> Create the object of SpeechSynthesizer class:
SpeechSynthesizer ss = new SpeechSynthesizer();

--> Set the volume of voice (1 to 100):
ss.Volume = n;

--> Set the speed of speaking (-10 to +10):
ss.Rate = n;

--> Change the voice gender and age:
ss.SelectVoiceByHints(VoiceGender.xxxx, VoiceAge.xxxx);

--> Speak the text:
ss.SpeakAsync(message);

Program for Speech Translation :-
==============================


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Synthesis;
namespace SpeechTranslationDemo
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter text to speak:");
string TextToSpeak = Console.ReadLine();
SpeechSynthesizer ss = new SpeechSynthesizer();
ss.Volume = 100; //1 to 100
ss.Rate = -3; // -10 to +10
ss.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Child);
ss.SpeakAsync(TextToSpeak);
Console.Read();
}
}
}

Small Project of Speech Tranlator in WindowForm :-
================================================

Speech Translation


Program for SpeechTranslator :-
============================

using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Speech.Synthesis;

namespace Speech_Translator
{
public partial class SpeechTranslationForm : Form
{
public SpeechTranslationForm()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
string TextToSpeak = txtSpeech.Text;
SpeechSynthesizer ss = new SpeechSynthesizer();
ss.Volume = 100; //1 to 100
ss.Rate = -3; // -10 to +10
ss.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Child);
ss.SpeakAsync(TextToSpeak);
}
}
}


Comments

Author: srirama15 Sep 2015 Member Level: Gold   Points : 0

This is good article. You come with the Most innovative article that's really nice i want all Dns Members to come out with such interesting and innovative articles,,,,,



  • 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: