1. Windows7 built-in speech recognition
2, text-to-speech added Microsoft Lili-chinese (China), support Chinese-English mixed reading
3, female voice, part of the phrase basic pronunciation accurate
I have the impulse to make a small program, as follows:
1. Introduction of SpeechLib.dll
2. Create a form
3. Write code
Public Partial classFormmain:form
{
PublicFormMain ()
{
InitializeComponent ();
}
Private voidFormmain_load (Objectsender, EventArgs e)
{
Getvoices ();
}
Private voidgetvoices ()
{
SpVoice Voice= NewSpvoiceclass ();
Ispeechobjecttokens Voices=Voice. Getvoices ("", "");
var list= NewList<string>();
foreach(Ispeechobjecttoken tokeninchvoices)
List. ADD (token. GetDescription (0));
Cbspeechtype.datasource=list;
}
Private voidBtnspeechtext_click (Objectsender, EventArgs e)
{
Speechtext (NULL);
}
Private voidSpeechtext (stringfileName)
{
Cursor=Cursors.waitcursor;
Spfilestream Stream= NULL;
SpVoice Voice= NewSpvoiceclass ();
if(FileName+ "" != "")
{
Stream= NewSpfilestreamclass ();
Stream. Open (FileName, Speechstreamfilemode.ssfmcreateforwrite,false);
Voice. Audiooutputstream=stream;
}
Voice. Voice=Voice. Getvoices ("", ""). Item (Cbspeechtype.selectedindex);
Voice. Volume=Tbvol.value;
Voice. Rate=Tbspeechspeed.value;
Voice. Speak (Tbtext.text, Speechvoicespeakflags.svsfdefault);
if(FileName+ "" != "" &&Stream!= NULL)
Stream. Close ();
Cursor=Cursors.arrow;
}
Private voidBtnrecordspeech_click (Objectsender, EventArgs e)
{
Cursor=Cursors.waitcursor;
using(Var savefiledialog= NewSaveFileDialog ())
{
Savefiledialog.filename= "Myvoice.wav";
Savefiledialog.filter= "Wave (*.wav) |*.wav";
if(Savefiledialog.showdialog ()==DialogResult.OK)
{
Speechtext (Savefiledialog.filename);
}
}
Cursor=Cursors.arrow;
}
}
The above features support the text in the text box, support to speak text output voice files;
Reference Application Scenario:
1, taste fresh, and then delete
2, convert the text of the novel into audio MP3 inside to listen
3. Cheat and cheat children
Operational environment Requirements:
1. WINDOWS 7
2. Other unknown
Say more than put a code, so this article is simple, please download and run the compilation.
Anyspeech.rar
Source: http://www.cnblogs.com/Chinasf/archive/2010/01/04/1639282.html
Call Windows 7 in English mixed read aloud