Copyright © 2001-2018 MultiMedia Soft

SoundGenerator.StreamCreateNoise method

Previous pageReturn to chapter overviewNext page

Remarks

 

Creates a noise audio stream and loads it inside the given player.

 

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]

control.SoundGenerator.StreamCreateNoise (

nPlayer as Integer,

nSampleRate as Long,

bMono as enumBoolean,

nNoiseType as enumSoundGenNoiseTypes,

fReserved as Single,

fAmplitude as Single,

nDurationMs as Long,

nFadeInMs as Long,

nFadeOutMs as Long

) as enumErrorCodes


 

[C++]

short control.SoundGenerator.StreamCreateNoise (

short nPlayer,

long nSampleRate,

short bMono,

short nNoiseType,

float fReserved,

float fAmplitude,

long nDurationMs,

long nFadeInMs,

long nFadeOutMs

);


 

Parameter

Description

 

 

nPlayer

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

BOOL_FALSE

Creates a stereo audio stream

BOOL_TRUE

Creates a mono audio stream

nNoiseType

Type of noise.

Supported values are the following:

Mnemonic Value

Value

Meaning

SOUNDGEN_NOISE_TYPE_WHITE

0

White noise

SOUNDGEN_NOISE_TYPE_PINK

1

Pink noise

SOUNDGEN_NOISE_TYPE_BROWN

2

Brown noise

fReserved

Reserved for future uses, set this parameter to 0

fAmplitude

Noise 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

nDurationMs

Duration of the noise expressed in milliseconds.

In case you should need to create an endless noise, use the SoundGenerator.StreamCreateMultiChannelEmpty method in combination with the SoundGenerator.StreamChannelAddNoise method having the nDurationMs parameter set to 0.

nFadeInMs

Duration of the fade-in at the beginning of the noise 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 noise 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, check the LastError property value in order to get the error code

enumErrorCodes.ERR_NOERROR (0)

The method call was successful