Audio Recording-Mute Detection

Source: Internet
Author: User
During language transmission, if data packets are sent each time, the packet can be muted before being sent.
Principle: checks whether all data is within the same range and counts the amount of data that is not within the range. Even if the percentage is used, it is set to mute if a specified proportion is printed.

// 8-bit audio
Function twavein. detectsilence (data: pbyte; datalen: DWORD): Boolean;
Const
Threshold: DWORD = 10; // range
Hitpercent: DWORD = 85; // Error Rate
VaR
I: integer;
Dwhit: DWORD;
Begin
Dwhit: = 0;
For I: = 0 to DataLen-1 do
Begin
If (Data ^ <= threshold) or (Data ^> = (255-threshold) then
Begin
INC (dwhit );
End;
INC (data );
End;
If (dwhit * 100)> = (hitpercent * datalen) then
Result: = true
Else
Result: = false;
End;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.