SpeakToFile

(VoiceTalk Module)

Description: Executes on the speech thread to speak the supplied text to a .wav format audio file.
Returns: Nothing
Usage: Script Only.
Function Groups: Speech and Sound,  File I/O
Related to: Configure | GetDevices | GetVoices | Reset | ShowLexicon | Speak | VoiceTalk
Format: VoiceTalkStream\SpeakToFile(Phrase, Flags, Filename, Quality[, Result])
Parameters:  
VoiceTalkStream
Required. A speech stream returned from VoiceTalk that you wish to speak the given phrase.
Phrase
Required. Any text expression that will be spoken on a specified stream.
This is limited to the number of characters specified by MaxSpeakToFileLength, defaulting to 1000.
Flags
Required. A parameter to specify speaking flags to the stream. All text will be spoken asynchronously (i.e. the function will not wait for the speech to complete speaking). Flags can be used to specify other parsing of the text. The values for Flags can be any combination of the following

Flags

Meaning

0

Use default settings (speak asynchronously)

1

Speak asynchronously.

2

Purge speaking queue before speaking text. This cancels all pending and current speech, and then immediately begins speaking the new text.

4

Regard the Text parameter as a filename, and speak the contents of that file.

8

Parse text for XML markup.

16

Do not parse text for XML markup.

32

Any XML state changes in the text will persist across any future VoiceTalk\Speak calls.

64

Punctuation characters should be spoken (i.e. "Hello, there." would be spoken as "Hello comma there period").

As indicated above, an Invalid value, or a value of "0" or "1" for the Flags parameter will have the same result.

Filename
Required. The name of the .wav file to speak into (e.g. "c:\folder\file.wav")
Quality
Required. The format quality to use, as defined by the following table:

Quality

Format

Quality

Format

-1

SAFTdefault

4

SAFT8kHz8BitMono

5

SAFT8kHz8BitStereo

6

SAFT8kHz16BitMono

7

SAFT8kHz16BitStereo

8

SAFT11kHz8BitMono

9

SAFT11kHz8BitStereo

10

SAFT11kHz16BitMono

11

SAFT11kHz16BitStereo

12

SAFT12kHz8BitMono

13

SAFT12kHz8BitStereo

14

SAFT12kHz16BitMono

15

SAFT12kHz16BitStereo

16

SAFT16kHz8BitMono

17

SAFT16kHz8BitStereo

18

SAFT16kHz16BitMono

19

SAFT16kHz16BitStereo

20

SAFT22kHz8BitMono

21

SAFT22kHz8BitStereo

22

SAFT22kHz16BitMono

23

SAFT22kHz16BitStereo

24

SAFT24kHz8BitMono

25

SAFT24kHz8BitStereo

26

SAFT24kHz16BitMono

27

SAFT24kHz16BitStereo

28

SAFT32kHz8BitMono

29

SAFT32kHz8BitStereo

30

SAFT32kHz16BitMono

31

SAFT32kHz16BitStereo

32

SAFT44kHz8BitMono

33

SAFT44kHz8BitStereo

34

SAFT44kHz16BitMono

35

SAFT44kHz16BitStereo

36

SAFT48kHz8BitMono

37

SAFT48kHz8BitStereo

38

SAFT48kHz16BitMono

39

SAFT48kHz16BitStereo

Result
Required. A pointer to a flag to set when done. This should be 0 for OK or 1 for an error.
Comments: The text may include embedded XML tags as described in the documentation for the SAPI speech engine being used.
Multiple calls to this function will be queued.
Calls to this module will fail if the VoiceTalk instance was not configured for VTSFileOutput.