Copyright © 2011-2023 MultiMedia Soft

SoundGenerator.WaveToneGenerate method

Previous pageReturn to chapter overviewNext page

Remarks

 

Generates and load into the editor a wave tone audio stream.

 

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

nWaveType as enumSoundGenWaveTypes,

nSampleRate as Int32,

nChannels as Int32,

fFrequency as Single,

fAmplitude as Single,

nDurationMs as Int32,

nFadeInMs as Int32,

nFadeOutMs as Int32

) as enumErrorCodes


 

[C#]

public enumErrorCodes WaveToneGenerate (

enumSoundGenWaveTypes nWaveType,

Int32 nSampleRate,

Int32 nChannels,

float fFrequency,

float fAmplitude,

Int32 nDurationMs,

Int32 nFadeInMs,

Int32 nFadeOutMs

);


 

[C++]

public: enumErrorCodes WaveToneGenerate (

enumSoundGenWaveTypes nWaveType,

Int32 nSampleRate,

Int32 nChannels,

float fFrequency,

float fAmplitude,

Int32 nDurationMs,

Int32 nFadeInMs,

Int32 nFadeOutMs

);


 

Parameter

Description

 

 

nWaveType

Type of wave tone.

Supported values are the following:

Mnemonic Value

Value

Meaning

SOUNDGEN_WAVE_TYPE_SINE

0

Sine wave

SOUNDGEN_WAVE_TYPE_SQUARE

1

Square wave

SOUNDGEN_WAVE_TYPE_SAWTOOTH

2

Sawtooth wave

SOUNDGEN_WAVE_TYPE_SAWTOOTH_NEGATIVE

3

Negative sawtooth wave

SOUNDGEN_WAVE_TYPE_TRIANGLE

4

Triangle wave

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

fFrequency

Wave tone frequency expressed in Hertz

fAmplitude

Wave tone 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

nDurationMs

Duration of the wave tone expressed in milliseconds.

nFadeInMs

Duration of the fade-in at the beginning of the wave 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 wave 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.