Copyright © 2005-2018 MultiMedia Soft

SoundGenerator.StreamCreateSlidingTone method

Previous pageReturn to chapter overviewNext page

Remarks

 

Creates a sliding wave tone audio stream and loads it inside the given player. This method allows sliding the wave tone frequency and/or the wave tone amplitude.

 

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 StreamCreateSlidingTone (

nPlayerIndex as Int16,

nSampleRate as Int32,

bMono as bool,

nWaveType as enumSoundGenSlidingWaveTypes,

fFrequencyStart as Single,

fFrequencyEnd as Single,

fAmplitudeStart as Single,

fAmplitudeEnd as Single,

bLogInterpolation as bool,

nDurationMs as Int32,

nFadeInMs as Int32,

nFadeOutMs as Int32

) as enumErrorCodes


 

[C#]

public enumErrorCodes StreamCreateSlidingTone (

Int16 nPlayerIndex,

Int32 nSampleRate,

bool bMono,

enumSoundGenSlidingWaveTypes nWaveType,

float fFrequencyStart,

float fFrequencyEnd,

float fAmplitudeStart,

float fAmplitudeEnd,

bool bLogInterpolation,

Int32 nDurationMs,

Int32 nFadeInMs,

Int32 nFadeOutMs

);


 

[C++]

public: enumErrorCodes StreamCreateSlidingTone (

Int16 nPlayerIndex,

Int32 nSampleRate,

bool bMono,

enumSoundGenSlidingWaveTypes nWaveType,

float fFrequencyStart,

float fFrequencyEnd,

float fAmplitudeStart,

float fAmplitudeEnd,

bool bLogInterpolation,

Int32 nDurationMs,

Int32 nFadeInMs,

Int32 nFadeOutMs

);


 

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:

Mnemonic Value

Meaning

false

Creates a stereo audio stream

true

Creates a mono audio stream

nWaveType

Type of wave tone.

Supported values are the following:

Mnemonic Value

Value

Meaning

SOUNDGEN_SLIDING_WAVE_TYPE_SINE

0

Sine wave

SOUNDGEN_SLIDING_WAVE_TYPE_SQUARE

1

Square wave

SOUNDGEN_SLIDING_WAVE_TYPE_SAWTOOTH

2

Sawtooth wave

SOUNDGEN_SLIDING_WAVE_TYPE_SQUARE_NO_ALIAS

3

Square wave without aliasing

fFrequencyStart

Initial wave tone frequency expressed in Hertz, e.g. 700

fFrequencyEnd

Final wave tone frequency expressed in Hertz, e.g. 1000

fAmplitudeStart

Initial wave tone amplitude.

- value 0.0 means that sound volume is muted

- values higher than 0.0 and smaller than 1.0 attenuates the sound volume

- value 1.0 sets the sound at full volume

- values higher than 1.0 amplifies the sound volume

fAmplitudeEnd

Final wave tone amplitude.

- value 0.0 means that sound volume is muted

- values higher than 0.0 and smaller than 1.0 attenuates the sound volume

- value 1.0 sets the sound at full volume

- values higher than 1.0 amplifies the sound volume

bLogInterpolation

Boolean value indicating if the sliding should use linear or logarithmic interpolation.

Supported values are the following:

Mnemonic Value

Meaning

false

Uses linear interpolation

true

Uses logarithmic interpolation

nDurationMs

Duration of the wave tone expressed in milliseconds

nFadeInMs

Duration of the fade-in at the beginning of the tone expressed in milliseconds. Set this value to 0 if you don't need to apply a fade-in at the beginning of the audio stream.

nFadeOutMs

Duration of the fade-out at the end of the tone expressed in milliseconds. Set this value to 0 if you don't need to apply a fade-out at the end of the audio stream.

 

 

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.