[Tutor] File Stream Assignment?

FT chester_lab at fltg.net
Sat Jun 21 10:04:54 CEST 2008


On: Friday, June 20, 2008 11:47 PM
Kent Johnson Wrote:
On Fri, Jun 20, 2008 at 5:47 PM, FT <chester_lab at fltg.net> wrote:

>    I would like to know how a file can be open for a stream event?

What is a stream event?

>    I ask this question because of the SAPI 5 save a wave file and the only
> way to do that is with a file stream. The file read is simple and uses the
> isfilename flag, but the save file I can not find in all my searches, at
> least for python.

I have no idea what you are talking about.

Kent


Kent,

    This is what I got from the Microsoft SAPI web site. They have only code
for C and VB and below is the VB version. I am trying to figure out where
the stram gets assigned to the speak method for SAPI so a file can be saved.

The following code illustrates how to speak a text file in a specific voice
in Visual
Basic. This example assumes a text file (ttstemp.txt) containing the text to
be spoken
already exists. ISpeechVoice.SpeakStream is used here to speak an
SpFileStream that
has been bound to the file.
Dim FileName As String
Dim FileStream As New SpFileStream
Dim Voice As  SpVoice
'Create SAPI voice
Set Voice = New SpVoice
'Assume that ttstemp.txt exists
FileName = "c:\ttstemp.txt"
'Open the text file
FileStream.Open FileName, SSFMOpenForRead, True
'Select Microsoft Sam voice
Set Voice.voice = voice.GetVoices("Name=Microsoft Sam",
"Language=409").Item(0)
'Speak the file stream
Voice.SpeakStream FileStream
'Close the Stream
FileStream.Close
'Release the objects
Set FileStream = Nothing
Set Voice = Nothing

So, in this example it assigns a file stream to the file opened then
connects to the SAPI Speak method to save it. But when I do that like they
did above I get only the data spoken and the file with 0 bytes in it.

    I have tried looking everywhere for the file stream connection and can
not seem to find the method to do so.

        Bruce



More information about the Tutor mailing list