Copyright © 2011-2019 MultiMedia Soft

SilencePositionsDetect method

Previous pageReturn to chapter overviewNext page

Remarks

 

Detects positions of silent portions inside the loaded sound and store them inside a list. The list of detected silent portions can be enumerated at a later time through the SilencePositionsNumGet and SilencePositionsGetRange methods.

Silence detection can be canceled at any time through the SilencePositionsCancelDetect method.

 

During the execution of the silence detection the CallbackPercentage delegate is invoked, with the nOperation parameter set to OPERATION_SILENCE_DETECTION, in order to notify about the percentage of advancement.

 

For further details about callback delegates see the How to synchronize the container application with the API tutorial.

 

 

Syntax

 

[Visual Basic]

Public Function SilencePositionsDetect (

nSilenceThreshold as Int16,

nSilenceMinLength as Int32,

bIgnoreInitAndFinal as enumBoolean

) as enumErrorCodes


 

[C#]

public enumErrorCodes SilencePositionsDetect (

Int16 nSilenceThreshold,

Int32 nSilenceMinLength,

bool bIgnoreInitAndFinal

);


 

[C++]

public: enumErrorCodes SilencePositionsDetect (

Int16 nSilenceThreshold,

Int32 nSilenceMinLength,

bool bIgnoreInitAndFinal

);


 

 

Parameter

Description

 

 

nSilenceThreshold

Number representing the silence threshold referred to the volume level. Supported values are expressed with a linear volume in the range from 0 to 32767. If for example you should set a value of 800, any portion of sound having a volume level lower than 800 would be considered as silent.

In case you should need to set a threshold value expressed in dB, before setting this parameter you could convert the value in dB into a linear value through the following formula (C syntax):

ValueLinear = 32767 * pow (10, ValueInDB/20);

nSilenceMinLength

Number representing the minimal length of silence expressed in milliseconds. If for example you wish to consider as "silent" only those portions of sound whose duration is above one second, you would have to set this value to 1000.

bIgnoreInitAndFinal

Boolean flag that determines if silence available on the beginning and on the end of the file must be included in final results.

Supported values are the following:

Mnemonic Value

Meaning

false

Include initial and final silent portions inside the list.

true

Ignore initial and final silent portions and exclude them from being listed.

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred. Check the LastError property value in order to see the last error.

enumErrorCodes.ERR_NOERROR (0)

The method call was successful.