Copyright © 2008-2023 MultiMedia Soft

SoundGenerator.SpeechGenerateFromString method

Previous pageReturn to chapter overviewNext page

Remarks

 

Generates and load into the editor a speech audio stream from a string of text.

 

The text string may eventually contain XML markup: see the MSDN documentation for a tutorial about XML markup syntax.

 

For further details about sound generation see the SoundGeneratorMan class and the How to generate wave tones, noises, DTMF tones and text to speech tutorial.

 

 

Syntax

 

[Visual Basic]

Public Function SpeechGenerateFromString (

nSampleRate as Int32,

nChannels as Int32,

strTextToSpeech as String,

nVoice as Int32,

fAmplitude as Single,

bRemoveFinalSilence as Boolean

) as enumErrorCodes


 

[C#]

public enumErrorCodes SpeechGenerateFromString (

Int32 nSampleRate,

Int32 nChannels,

string strTextToSpeech,

long nVoice,

float fAmplitude,

bool bRemoveFinalSilence

);


 

[C++]

public: enumErrorCodes SpeechGenerateFromString (

Int32 nSampleRate,

Int32 nChannels,

string strTextToSpeech,

long nVoice,

float fAmplitude,

bool bRemoveFinalSilence

);


 

Parameter

Description

 

 

nSampleRate

Sample rate of the stream, e.g. 44100

nChannels

Number of channels of the audio stream.

Supported values are the following:

Value

Meaning

1

Mono audio stream

2

Stereo audio stream

4

3.1 audio stream

6

5.1 audio stream

8

7.1 audio stream

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 SpeechVoicesNumGet method.

fAmplitude

Audio stream amplitude.

- value 0.0 means that sound volume is muted

- values higher than 0.0 and lower 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:

Value

Meaning

false

Don't remove final silence

true

Remove final silence

 

 

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.