Copyright © 2008-2023 MultiMedia Soft

SoundComposer.ItemSpeechFromStringAdd method

Previous pageReturn to chapter overviewNext page

Remarks

 

Adds a speech item, contained inside a string, to the audio stream previously created through the SoundComposer.SessionInit method. In case you should need to add a text to speech stream from contents of a text file you may use the SoundComposer.ItemSpeechFromFileAdd method.

 

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

 

For further details about sound composing see the the SoundComposerMan class and the How to compose a sound tutorial.

 

 

Syntax

 

[Visual Basic]

Public Function ItemSpeechFromStringAdd (

strFriendlyName as String,

nChannel as Int16,

strTextToSpeech as String,

nVoice as Int32,

bRemoveFinalSilence as Boolean,

fAmplitude as Single,

nOffsetMs as Int32,

ByRef nUniqueId as Int32

) as enumErrorCodes


 

[C#]

public enumErrorCodes ItemSpeechFromStringAdd (

string strFriendlyName,

Int16 nChannel,

string strTextToSpeech,

Int32 nVoice,

bool bRemoveFinalSilence,

float fAmplitude,

Int32 nOffsetMs,

ref Int32 nUniqueId

);


 

[C++]

public: enumErrorCodes ItemSpeechFromStringAdd (

string strFriendlyName,

Int16 nChannel,

string strTextToSpeech,

Int32 nVoice,

bool bRemoveFinalSilence,

float fAmplitude,

Int32 nOffsetMs,

Int32 __gc  *nUniqueId

);


 

Parameter

Description

 

 

strFriendlyName

Friendly name of the item

nChannel

Channel of the audio stream that will reproduce the item: can be a value between 0 and the number of channels of the audio stream created through the SoundComposer.SessionInit 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 SpeechVoicesNumGet method and related attributes can be obtained through the SpeechVoiceAttributeGet method.

bRemoveFinalSilence

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

Supported values are the following:

Mnemonic Value

Meaning

false

Don't remove final silence

true

Remove final silence

fAmplitude

Amplitude of the voice.

- value 0.0 means that the voice is muted

- values higher than 0.0 and lower than 1.0 attenuate the voice

- value 1.0 sets the voice at full volume

- values higher than 1.0 amplify the voice

nOffsetMs

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

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:

 

- SoundComposer.ItemSpeechFileSet to modify the absolute pathname of the file containing the text to speech

- SoundComposer.ItemSpeechStringSet to modify the string of the text to speech

- SoundComposer.ItemSpeechTextGet to obtain the current string of text to speech or the pathname of the file containing the text to speech

- SoundComposer.ItemSpeechVoiceGet to obtain the speaking voice

- SoundComposer.ItemSpeechVoiceSet to modify the speaking voice

 

- SoundComposer.ItemAmplitudeGet to obtain the amplitude of the item

- SoundComposer.ItemAmplitudeSet to modify the amplitude of the item

- SoundComposer.ItemChannelGet to obtain the channel of of the audio stream that will reproduce the item

- SoundComposer.ItemChannelSet to modify the channel of of the audio stream that will reproduce the item

- SoundComposer.ItemRemove to remove the item from the sound composition

- SoundComposer.ItemDurationGet to obtain the duration, expressed in milliseconds, of the item

- SoundComposer.ItemOffsetGet to obtain the offset, expressed in milliseconds, of the item respect to the beginning of the audio stream

- SoundComposer.ItemOffsetSet to modify the offset, expressed in milliseconds, of the item respect to the beginning of the audio stream

- SoundComposer.ItemTypeGet to obtain the item's type

- SoundComposer.ItemFriendlyNameGet to obtain the friendly name of the item

- SoundComposer.ItemFriendlyNameSet to modify the friendly name of the item

 

The usage of the SoundComposer.ItemDurationSet method is not supported on text to speech because the duration of the item strictly depends upon the number of words inside the text to synthesize and upon the presence of eventual XML markups.

 

 

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.