Noise Analysis is generated after the audio is filtered.

Source: Internet
Author: User

Recently, we are working on Digital Filter Research to use these filters to implement some audio functions. Encountered such a problem,AlgorithmUse. m in MATLABCodeDuring the simulation, the results were good and the design was expected. However, some garbage BITs appeared in the C code, and noise appeared in terms of auditory performance, in the frequency field, some impluse in the frequency field will appear.

The reason for the analysis is that the conversion of different data types is not good enough, but it is actually some simple details, but often the Details determine the success or failure.

For example, audio typically uses 16 bits short data, but in C, float or double data is often used as the storage value for intermediate operations, this may result in converting the float or double type data to the short type in the middle or the final result.

Double result;

Short output;

If (result> 32768.0)

Result = 32768.0;

Else if (result <-32768.0)

Results =-32768.0;

 

Output = (short) result;

 

This process implies a major error because 0x8000 = 32768. But for short: ox8000 is a negative number, and the above operation will change the original maximum data to a negative number.

The direct consequence will be noise. It should be changed to the following form:

Double result;

Short output;

If (result >=32768.0)

Result = 32767.0;

Else if (result <-32768.0)

Results =-32768.0;

 

Output = (short) result;

 

A small problem is often difficult for hero. Here we record that this is accumulation of experience. If you are in the same industry, it is really good to encounter the MATLAB algorithm during algorithm design, but if you encounter such a strange problem in C implementation, you can send it to me, I will solve it with you.

 

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.