Copyright © 2001-2019 MultiMedia Soft

SoundGenerator.StreamChannelAddSpeechFromString method

Previous pageReturn to chapter overviewNext page

Remarks

 

Adds a speech element, obtained from a string of characters, to the audio stream previously created through the SoundGenerator.StreamCreateMultiChannelEmpty method.

 

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

 

When the rendering of the speech has been completed, the element itself is automatically removed from the the audio stream; if you need to create a speech that could be reproduced again after its complete rendering, use the SoundGenerator.StreamCreateSpeechFromString or SoundGenerator.StreamCreateSpeechFromFile methods.

 

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]

control.SoundGenerator.StreamChannelAddSpeechFromString (

nPlayer as Integer,

nChannel as Integer,

strTextToSpeech as String,

nVoice as Long,

fAmplitude as Single,

nOffsetMs as Long,

bRemoveFinalSilence as enumBoolean,

ByRef nUniqueId as Long

) as enumErrorCodes


 

[C++]

short control.SoundGenerator.StreamChannelAddSpeechFromString (

short nPlayer,

short nChannel,

LPCTSTR strTextToSpeech,

long nVoice,

float fAmplitude,

long nOffsetMs,

short bRemoveFinalSilence,

long *nUniqueId

);


 

Parameter

Description

 

 

nPlayer

Number representing the zero-based index of the involved player

nChannel

Channel of the audio stream that will reproduce the speech: can be a value between 0 and the number of channels of the audio stream created through the SoundGenerator.StreamCreateMultiChannelEmpty method.

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 and related attributes can be obtained through the SoundGenerator.SpeechVoiceAttributeGet 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

nOffsetMs

Offset of the speech, expressed in milliseconds, respect to the beginning of the audio stream.

bRemoveFinalSilence

Boolean flag that specifies to remove the final silence usually introduced by the Speech API.

Supported values are the following:

Mnemonic Value

Meaning

BOOL_FALSE

Don't remove final silence

BOOL_TRUE

Remove final silence

nUniqueId

Reference to a value that, on return from the method call, will contain the unique identifier of the newly added element: this unique identifier will be used in order to invoke further methods related to the use of this specific element.

- SoundGenerator.StreamElementAmplitudeSet and SoundGenerator.StreamElementAmplitudeGet to modify and retrieve the amplitude of the text to speech element.

- SoundGenerator.StreamElementSpeechTextGet to obtain the string containing the pathname of the text file

- SoundGenerator.StreamElementSpeechVoiceGet to obtain the voice used to speak

- SoundGenerator.StreamElementRemove to remove the wave tone element from the audio stream.

- SoundGenerator.StreamElementDurationGet to obtain the duration of the wave tone element.

- SoundGenerator.StreamElementOffsetGet to obtain the offset of the wave tone element.

 

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred, check the LastError property value in order to get the error code

enumErrorCodes.ERR_NOERROR (0)

The method call was successful