SoundGenerator.StreamCreateSpeechFromString method |
|
Remarks
Creates a speech audio stream from a string of text and loads it inside the given player. In case you should need to generate an audio stream from text contained inside a file you may use the SoundGenerator.StreamCreateSpeechFromFile method.
The text string may eventually contain XML markup: see the MSDN documentation for a tutorial about XML markup syntax.
Once created, the audio stream can be played through the PlaySound method, paused through the PauseSound method and stopped through the StopSound method. Once no more needed, the audio stream can be discarded from memory through the CloseSound method.
For further details about sound generation see the SoundGenerator object and the How to generate wave tones, noises, DTMF tones and text to speech tutorial.
Syntax
[Visual Basic] Public Function StreamCreateSpeechFromString ( nPlayerIndex as Int16, nSampleRate as Int32, bMono as bool, strTextToSpeech as String, nVoice as Int32, fAmplitude as Single, bRemoveFinalSilence as bool ) as enumErrorCodes |
[C#] public enumErrorCodes StreamCreateSpeechFromString ( Int16 nPlayerIndex, Int32 nSampleRate, bool bMono, string strTextToSpeech, Int32 nVoice, float fAmplitude, bool bRemoveFinalSilence ); |
[C++] public: enumErrorCodes StreamCreateSpeechFromString ( Int16 nPlayerIndex, Int32 nSampleRate, bool bMono, string strTextToSpeech, Int32 nVoice, float fAmplitude, bool bRemoveFinalSilence ); |
Parameter |
Description |
||||||
|
|
||||||
nPlayerIndex |
Number representing the zero-based index of the involved player |
||||||
nSampleRate |
Sample rate of the stream, e.g. 44100 |
||||||
bMono |
Boolean value specifying if the audio stream is in mono or stereo. Supported values are the following:
|
||||||
strTextToSpeech |
String of text to speech |
||||||
nVoice |
Zero-based index of the speaking voice. The total number of voices installed inside the system can be obtained through the SoundGenerator.SpeechVoicesNumGet method. |
||||||
fAmplitude |
Audio stream amplitude. - value 0.0 means that sound volume is muted - values higher than 0.0 and smaller than 1.0 attenuate the sound volume - value 1.0 sets the sound at full volume - values higher than 1.0 amplify the sound volume |
||||||
bRemoveFinalSilence |
Boolean flag that specifies to remove the final silence usually introduced by the Speech API. Supported values are the following:
|
Return value
Value |
Meaning |
|
|
Negative value |
An error occurred (see the LastError property for further error details) |
enumErrorCodes.NOERROR (0) |
The method call was successful. |