|
|
Line 1: |
Line 1: |
− | Below are some usage tips for the [[Audio Level]] DirectShow filter.
| + | Brief description of the [[Audio Level]] DirectShow filter capabilities. |
| + | Interface IMLAudioLevel can be found in file <filter installation directory>\Idl\ALevel.idl |
| | | |
| ==Configuration & Usage== | | ==Configuration & Usage== |
| | | |
− | Audio trigger is used for getting the level of amplitude in an audio stream. When the amplitude of the signal reaches the specified level, the application gets sent messages. The threshold of triggering may work at both the upper and the lower front. The upper one reacts on exceeding the given level of the signal amplitude, while the lower one reacts on the amplitude level detraction. The following example, - determining silence in a sound channel, - illustrates the usage of the audio trigger.
| + | <OL> |
| + | Number of channels |
| + | The number of channels in the connected audio stream can be obtained using the IMLAudioLevel::GetChannels() function. Maximum possible number of channels: 32. |
| + | </OL> |
| + | <br><br> |
| | | |
| <OL> | | <OL> |
− | <LI>
| + | VU-meter |
− | First, we should choose the type of the messages, sent by the trigger. Currently 3 message types are supported:
| + | The current sound level in dB for the specified channel can be get using IMLAudioLevel::GetLevel() method. |
− | * trigger notification interface (IAudioLevelNotify),
| + | VU-meter properties (attack and release time in ms) are set using methods IMLAudioLevel::SetAttackTime() and SetReleaseTime(). |
− | * handles to events objects,
| + | The attack (rise) time is the time to reach an amplitude of 90% (-2dB) for a step signal of 0 -> 1, and the release (fall) time is an amplitude of 10% (-20dB) for a step signal of 1 -> 0. |
− | * DirectShow event notifications.
| + | If the VU-meter is not needed, then its operation can be disabled using the IMLAudioLevel::EnableProcessing() method. |
− | According to the message types 3 corresponding functions are provided: AdviseNotify, AdviseEvent and AdviseDSEvent.
| + | |
− | <LI>
| + | |
− | Then the trigger's front has to be chosen. In case of determining silence in a channel we need the lower front.
| + | |
− | <LI>
| + | |
− | The trigger works in the following way. When the triggering threshold of the signal level is reached, the application is sent the OnLevelReachedBegin message. As soon as the signal level leaves the triggering threshold, the application is sent the OnLevelReachedEnd message. The triggering threshold can be specified in two units: decibels (dB) and percent (%) divided by 100. When specified in percent, the threshold value belongs to the interval from 0 up to 1. For instance, when determining silence, the threshold may have value 0.17, which is 17%.
| + | |
− | <LI>
| + | |
− | Now is time to set the triggering delay in milliseconds (ms). When the given threshold is reached, the signal has to be at that level for the given number of ms for the trigger to switch. When the delay is passed the application will get sent the OnLevelReachedBegin message. But this message will not be sent if the signal leaves the given level before the delay expires.
| + | |
− | To determine silence in a channel, a normal value for the triggering delay is 500 ms. If the lower front chosen, and the threshold equals to 0.17, and the signal remains below the threshold for 500 ms, the application will get the OnLevelReachedBegin message, which means that silence started in the channel. As soon as the signal exceeds 0.17, the application will get the OnLevelReachedEnd message, which means that there's no silence in the channel any longer.
| + | |
− | <LI>
| + | |
− | The rest of parameters and the way of processing depend on the message type. When using the notification interface message type, the application has to pass a reference to the event interface. When dealing with standard Windows messages, - handles to event objects have to be passed. Use the CreateEvent function for creating handles. And when using DirectShow notifications, DirectShow interfaces are used for handling messages. The corresponding constants for the messages are EC_LEVEL_REACHED_BEGIN and EC_LEVEL_REACHED_END.
| + | |
− | <LI>
| + | |
− | The Unadvise method uses to terminate the advise link established with the IAudioLevel interface. The dwAdviseCookie parameter identifies the link to terminate.
| + | |
| </OL> | | </OL> |
| <br><br> | | <br><br> |
− | Auto gain control: There are 3 modes, used to avoid acoustic overfilling:
| |
− | * Without control (there will be crackle if the signal is amplified).
| |
− | * Fixed mode, which is when a maximum amplification koefficient is specified. Further, while processing the signal, the sound level is adjusted automatically to avoid overfilling.
| |
− | * Float mode. The sound level is continuously approaching the specified amplification mark, at the same time avoiding overfilling.
| |
− | When in the fixed mode, the level used is the highest possible. When in the float mode, the average level is used. Float is good when the signal is an ordinary sound.
| |
− | <br><br><br>
| |
− | You can get any extra information from the interface definition in the IDL file.
| |