The main use of the TTS speech reading SDK
Recently played a lot of voice reading, but also in two of software applications. In fact, most of the voice reading code is still very good to write, just like to determine whether TTS voice reading is over or the current voice engine state slightly to find the parameters. Here's a record:
Originally found on the internet on the Judge TTS reading completion event code WaitForSingleObject (SpVoice. Speakcompleteevent, 200), in the use of Delphi did not achieve the original seemingly should have the effect, the test found that this thing is only in TTS synthesis read stream after the return, White is the TTS just to read aloud, was judged to read aloud completed. Carefully looked up the parameters of the SpVoice, there is a Statdus property, the returned object can be obtained some useful property parameters such as: runningstate (Running state), Inputwordlegth (read aloud the sum of all the words of the sentence length), Inputwordposition (at the end of the current spoken word) ...
Where Runningstate has three states: read aloud text is fully rendered after the composition is returned Srsedone = 1 is being read aloud will return srseisspeaking = 2 Pause reading will return 0
Use these three properties to determine whether the reading is completed, add two timers, read the beginning of the sentence, start judging the reading state of the timer, complete and then reactivate the timer to read aloud:
Procedure Tform1.timer1timer (Sender:tobject);
Begin
Timer1. Enabled:=false;
Learntts.speak (' This is the VOA Explorations in Special english! ', 1);
WaitForSingleObject (learntts.speakcompleteevent, 200);
Timer2. Enabled:=true;
End
Procedure Tform1.timer2timer (Sender:tobject);
Begin
Edit1. Text:=inttostr (learnTTS.Status.RunningState);
If learntts.status.runningstate=1 then//read aloud when finished will return 1
Timer1. Enabled:=true;
End
Do a newspaper dictation software usually give the child dictation is too much trouble. Haha support Chinese English