Copyright © 2006-2019 MultiMedia Soft

How the Sound Activation System works

Previous pageReturn to chapter overviewNext page

The Sound Activation System allows skipping silent passages during a recording session: the sound activation system can be enabled or disabled through the nMode parameter of the SoundActivationSystemSet method. Current settings can be obtained through the SoundActivationSystemGet method.

 

When the Sound Activation System is enabled, the control will automatically recognize silent data during the recording session and will not store data inside the output file or in memory: the threshold that discriminates silent data from audible data is set through the nSilenceThreshold parameter and the minimal length the silent portions must have in order to be considered real silence can be set through the nSilenceMinLength parameter.

 

The use of Sound Activation System is especially useful in the following situations:

when the control is recording streaming data from the Internet and a net congestion stops the stream, allowing to avoid having spots without audible sound on the final output.
when you must optimize the memory or disk consumption during silent periods.
when you are monitoring an input channel for audible data (for example a microphone) and have no need to record silent periods: in this case the control has the optional ability to automatically create a log file that will report the exact recording time and silence skipping time: all you have to do is to set the strLogFile parameter of the SoundActivationSystemSet method to a valid absolute pathname. This log file will have a format as shown below:

 

[Recording start]  1/17/2006 14:19:22 {453463328}

[Silence start]    1/17/2006 14:19:22 {453463437}

[Silence end]      1/17/2006 14:19:25 {453466437}

[Silence start]    1/17/2006 14:19:26 {453467031}

[Silence end]      1/17/2006 14:19:31 {453472031}

[Silence start]    1/17/2006 14:19:31 {453472140}

[Silence end]      1/17/2006 14:19:38 {453479234}

[Silence start]    1/17/2006 14:19:38 {453479343}

[Silence end]      1/17/2006 14:19:39 {453479843}

[Silence start]    1/17/2006 14:19:39 {453480437}

[Silence end]      1/17/2006 14:19:50 {453490843}

[Silence start]    1/17/2006 14:19:50 {453491531}

[Silence end]      1/17/2006 14:19:59 {453500140}

[Silence start]    1/17/2006 14:20:00 {453501031}

[Silence end]      1/17/2006 14:20:03 {453504531}

[Recording end]    1/17/2006 14:20:04 {453504640}

 

The structure of the file should be quite self-explanatory: on each line the log file logs the exact date and time of recording start ([Recording start]) and recording end ([Recording end]) and all the transitions from silent data ([Silence start]) to audible data ([Silence end]) and between {} characters reports the exact number of milliseconds returned by a call to the GetTickCount Windows API: as you may know, the GetTickCount function retrieves the number of milliseconds that have elapsed since the system was started.

 

When the Sound Activation System is enabled and the recording session finds silent data, the container application is notified through the RecordingSilentData event; when the recording session finds again audible data, the container application is notified through the RecordingAudibleData event.

 

As a further feature, the Sound Activation System can be set to report silent portions of sound through the mentioned events without really discarding silence from the recorded sound: this can be achieved by setting the nMode parameter of the SoundActivationSystemSet method to SOUND_ACTIVATION_SYSTEM_KEEP_SILENCE.

 

IMPORTANT: When using the Sound Activation System is highly recommended storing recorded sound data on a file instead of a memory buffer.

 

The Sound Activation System is also supported when recording from sound files through the StartFromFile method: in this specific case the nMode parameter of the SoundActivationSystemSet method must be set to SOUND_ACTIVATION_SYSTEM_DISCARD_SILENCE; it's important to note that, when recording from sound files, the log is not generated.