Preparation
In. NetUsing speech recognition and speech synthesis technologiesMicrosoftSpeech SDKIf you wantWebApplicationProgram, You needSpeech application SDK. WhereSpeech SDKYou canHttp://www.microsoft.com/speech/download/sdk51/Download, which has two filesSpeech sdks 5.1And5.1 Language PackThe former is an development kit, but only supports English. The latter is a Language Pack for Chinese and Japanese. After installation, it supports Chinese.
SDKComposition Structure
Drill
1. open vs2005 , create a Windows application , add a label , one RichTextBox (used for Input text to be read ), and a button . label and text attribute. For example,
2.Add necessary references,Project>Add reference->Com SelectMicrosoft Speech Object LibraryPointOKExit.
3.Double-clickButtonTo add events. InCodeAdd a namespace at the top of the page. The Code is as follows:
Using Speechlib;
4.ButtonThe event handler code is as follows.
Private Void Button#click ( Object Sender, eventargs E)
{
Spvoiceclass voice = New Spvoiceclass ();
Voice. Voice = Voice. getvoices ( String . Empty, String . Empty). Item ( 3 ); // 3 of them are Chinese and are English.
Voice. Speak (richtextbox1.text, speechvoicespeakflags. svsfdefault );
}
5.PressF5Run, Enter text in the blank area, clickRead aloud, Try the effect.
SpvoiceclassDetails
Attribute |
Description |
Alertboundary |
Gets or sets the pause line. |
Allowaudiooutputformatchangesonnextset |
Set whether to allow the sound to automatically adjust to the appropriate status to adapt to its audio output. |
Audiooutput |
.Obtains or sets the audio output object used by the current sound. |
Audiooutputstream |
Gets or sets the audio output stream object used by the current sound. |
Eventinterests |
Gets or sets the event type returned by the current sound. |
Priority |
Gets or sets the voice priority. |
Rate |
Get or set the reading speed. |
Status |
ReturnsIspeechvoicestatusDisplays the status of the current read and event. |
Synchronousspeaktimeout |
Gets or sets a time interval to identify how long a synchronousSpeakAndSpeakstreamIt is terminated in milliseconds. |
Voice |
Obtains or sets the pronunciation object. |
Volume |
Obtains or sets the sound size. . |
Method |
Description |
Displayui |
Whether to display detailed settings in the control panel. |
Getaudiooutputs |
Returns an available audio output tag. |
Getvoices |
Returns an available pronunciation object. |
Isuisupported |
Determines whether the control can be achieved by controlling the audio settings of the Cotton Board. |
Pause |
Pause reading.. |
Resume |
Resume pause and Resume playback. |
Skip |
In the current text stream, jump forward or backward for a certain distance and then play back. |
Speak |
Read a string. |
Speakcompleteevent |
Get a time handle for reading. |
Speakstream |
Read a text stream or sound file. |
Waituntildone |
Blocks the process until the sound has been played or timed out.. |
. (This article is only the first article in this series. Other content will be discussed later. You are welcome to contact me .)