Copyright © 2005-2019 MultiMedia Soft

SoundGenerator.StreamChannelAddSpeechFromFile method

Previous pageReturn to chapter overviewNext page

Remarks

 

Adds a speech element, obtained from a text file, to the audio stream previously created through the SoundGenerator.StreamCreateMultiChannelEmpty method.

 

The text file 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]

Public Function StreamChannelAddSpeechFromFile (

nPlayerIndex as Int16,

nChannel as Int16,

strPathname as String,

nVoice as Int32,

fAmplitude as Single,

nOffsetMs as Int32,

bRemoveFinalSilence as bool,

ByRef nUniqueId as Int32

) as enumErrorCodes


 

[C#]

public enumErrorCodes StreamChannelAddSpeechFromFile (

Int16 nPlayerIndex,

Int16 nChannel,

string strPathname,

Int32 nVoice,

float fAmplitude,

Int32 nOffsetMs,

bool bRemoveFinalSilence,

ref Int32 nUniqueId

);


 

[C++]

public: enumErrorCodes StreamChannelAddSpeechFromFile (

Int16 nPlayerIndex,

Int16 nChannel,

string strPathname,

Int32 nVoice,

float fAmplitude,

Int32 nOffsetMs,

bool bRemoveFinalSilence,

Int32 __gc  *nUniqueId

);


 

Parameter

Description

 

 

nPlayerIndex

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.

strPathname

Absolute pathname of the text file

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

false

Don't remove final silence

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 (see the LastError property for further error details)

enumErrorCodes.NOERROR (0)

The method call was successful.