Groups > Microsoft > Microsoft Speech Tech > Re: Including a progress bar creating a WAV file




Including a progress bar creating a WAV file

Including a progress bar creating a WAV file
Wed, 2 Apr 2008 13:09:31 -0500
I must include a progress bar during WAV file creation. I work in Visual 
Foxpro 7. Win XP.

This progress bar can be created when SPVoice object speak aloud but when 
the AudioOutputStream is different this don´t work.

Does somebody have experience on this subject?

Thanks.

Alejandro Fernandez


*************************************************************************
The basic statements I´m using after creating the object Voice are:

Binding the object with the events of a SAPI instance.

LOCAL OEvents
OEvents=NEWOBJECT("Voix")      && Instance of SAPI.SPVoice
cpFileStream = CreateObject("SAPI.SpFileStream.1")   &&
Instance of 
SAPI.SpFileStream


*' Set output stream to the file stream
thisform.Voice.AllowAudioOutputFormatChangesOnNextSet = .f.
thisform.Voice.AudioOutputStream = cpFileStream
er=EVENTHANDLER(thisform.Voice,OEvents)

thisform.Voice.Speak(Thisform.edit2.text,1)
thisform.Voice.WaitUntilDone( -1)

**********************************************************


_ISpeechVoiceEvents_Word event gets Stream Position and length of spoken 
words
**********************************************************
 PROCEDURE _ISpeechVoiceEvents_Word(StreamNumber, StreamPosition , 
CharacterPosition, Length );
    && The whole text to speak
    mtext=ALLTRIM(_screen.activeform.edit2.text)

     && The lenght fo this text
    nlenght=LEN(mtext)

    =UpdateProgressbar(CharacterPosition, Length,nlenght)
endproc

**********************************************************
Procedure UpdateProgressbar
PARAMETERS Pos, Length,nlenght

todo=pos+Length
xlargo=(todo/nlenght)*50
_screen.activeform.Barra21.barra.width=xlargo*3      && Which updates 
progressbar width

ENDPROC

Post Reply
Re: Including a progress bar creating a WAV file
Wed, 2 Apr 2008 13:30:48 -0500
Sorry. This code is Visual Foxpro but I can understand suggestions in other 
languages.

Post Reply
about | contact