An audio signal measurement method for adaptively improving frequency measurement accuracy
By setting a fixed sampling rate and deviation ratio, adaptively adjusting the number of data extractions, and using FFT processing and window function calibration algorithms, the problem of insufficient frequency detection accuracy in the existing technology is solved, and the problem is achieved without increasing resources and costs. The frequency detection accuracy of the case is improved.
Patent Information
- Application Number
- CN202210282390.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-22
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-03-22
AI Technical Summary
The existing technology is difficult to improve the frequency detection accuracy of audio signal measurement without increasing the sampling rate and data volume, resulting in insufficient frequency measurement resolution.
By setting a fixed sampling rate and deviation ratio, primary and secondary signal collection is performed, and FFT processing and window function calibration algorithms are used to adaptively adjust the number of data extractions, improve frequency resolution, and achieve sampling without changing the sampling rate and data volume. The frequency detection accuracy of the case is improved.
It is possible to improve the frequency detection accuracy of audio signal measurement without increasing resources and costs, automatically evaluate and adjust the number of data extractions to meet the resolution required by the user, and improve the accuracy of frequency calculations.
Smart Images

Figure CN114838809B_ABST
Abstract
Description
Technical Field
[0001] The present invention is applied to the technical field of audio signal measurement, and in particular relates to an audio signal measurement method capable of adaptively improving frequency measurement accuracy. Background Art
[0002] In our daily life, various electronic devices with audio input, such as mobile phones and computers, and various electrical appliances have the function of audio acquisition. These audio acquisition modules need to verify their functions and performance before leaving the factory. Common parameters for evaluating audio acquisition functions are: frequency of input signal, amplitude of input signal, background noise, harmonic components, etc. The sound frequency range that the human ear can distinguish is 20-20000Hz, so the signal frequency that our audio module needs to test is also in this range. According to the Nyquist sampling theorem, as long as the sampling frequency is greater than or equal to twice the highest frequency of the effective signal, the sampling value can contain all the information of the original signal, and the sampled signal can be restored to the original signal without distortion. In the test process, the sampling frequencies of the analog-to-digital converters we commonly use are 48KHz, 96KHz, and 192KHz. In order to verify whether the signal frequency collected by the audio module is accurate, we need to convert the input signal from the time domain to the frequency domain, so that it is more convenient to calculate various indicators of the signal. FFT processing (Fast Fourier Transform) is to convert the time domain signal into the frequency domain signal. Its input parameters are: the signal to be tested and the sampling frequency.
[0003] The resolution calculation formula of FFT processing is: fp=Fs / N, where fp is the frequency resolution, Fs is the sampling rate, and N is the number of data points of the collected signal. If you want to improve the accuracy of measuring the signal frequency, you need to reduce the signal sampling rate or increase the number of data points of the collected signal.
[0004] Due to the uncertainty of the frequency of the front-end input signal, it is not possible to determine what the sampling rate setting is more appropriate. Moreover, once the hardware is determined and the chip of the analog-to-digital converter is also determined, the sampling rate that the analog-to-digital converter can choose to use is fixed. If you simply increase the amount of data collected by the signal, you will need to consume more resources and costs. Summary of the invention
[0005] The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art and provide an audio signal measurement method which adaptively improves the calculation resolution of FFT processing while keeping the sampling rate and the actual FFT processing calculation data amount unchanged, thereby improving the signal frequency detection accuracy.
[0006] The technical solution adopted by the present invention is: the audio signal measurement method of the present invention comprises the following steps:
[0007] Step S1: Set a fixed sampling rate Fs for the analog-to-digital converter for sampling and set the deviation ratio to k;
[0008] Step S2: When sampling for the first time, set the data extraction number m = 1 and do not process the amount of data sampled back by the analog-to-digital converter;
[0009] Step S3: Perform the first signal acquisition, read N data sampled back by the analog-to-digital converter and store them in the memory;
[0010] Step S4: After storage, perform windowing processing on the N data and then perform FFT operation processing to generate N complex-form data, and calculate the main frequency f1 of the input signal according to the sampling rate Fs of the analog-to-digital converter, the N complex-form data, the data extraction number m, and the calibration algorithm of the window function;
[0011] Step S5: Let the multiple relationship between the main frequency f1 of the input signal and the current frequency resolution fp be x, and x = f1 / fp, fp = Fs / N. Calculate the value of the current multiple relationship x according to the main frequency f1 of the input signal, and compare the value of the multiple relationship x with the set deviation ratio k value;
[0012] Step S6: When x < k, adjust the data extraction number m according to the main frequency f1 of the input signal obtained from the first sampling, the number of first sampling data N, the set deviation ratio k, and the current frequency resolution fp. The value of the data extraction number m is taken according to the intermediate variable n, n = (fp * k) / (N * f1). At the same time, perform secondary signal acquisition according to the adjusted data extraction number m and obtain new N data. Perform windowing processing on the new N data and then perform FFT operation processing to generate new N complex-form data;
[0013] Step S7: Calculate the main frequency f2 of the input signal according to the sampling rate Fs of the analog-to-digital converter, the new N complex-form data, the data extraction number m, and the calibration algorithm of the window function;
[0014] Step S8: Calculate the value of the current multiple relationship x according to the adjusted main frequency f2 of the input signal, and compare the value of the multiple relationship x with the set deviation ratio k value. When the value of x >= k, it means that the frequency resolution reaches the set range and output the measurement result, otherwise return to Step S6.
[0015] As can be seen from the above scheme, by analyzing the audio signal collected for the first time, it is determined whether a second processing analysis is needed according to the analysis result. When evaluating the extracted data value, the multiple relationship x of the main frequency f1 of the input signal and the current frequency resolution fp is compared with the set deviation ratio k, where k is a user-set value. When the k value is larger, the frequency resolution fp is higher. It can automatically evaluate whether the current detection frequency meets the resolution required by the user, and finally improve the accuracy of frequency calculation. And there is no need for the user to adjust the sampling rate of the analog-to-digital converter and the number of collected data according to the frequency of the input signal. Wherein, the selection of the window function in step S4 and step S7 is set according to the needs of the user.
[0016] A preferred solution is that the window function in step S4 and step S7 is a Nuttall four-term third-order window function.
[0017] It can be seen from the above scheme that the choice of window function is set according to the needs of the user. By selecting the Nuttall four-term third-order window function, the purpose is to make the sidelobe attenuation of thd+n <-80dB, thereby ensuring the measurement accuracy.
[0018] A further preferred solution is that the calibration algorithm for calculating the frequency of the Nuttall four-term third-order window function comprises the following steps:
[0019] Step C1: After the data is processed by FFT operation, it becomes N complex data x+yj, and the modulus p of the N complex data is obtained by calculation. ;
[0020] Step C2: Find the data with the largest modulus value The data with the second largest modulus value And the data corresponds to the sequential position in N data and ;
[0021] Step C3: Calculate the calibration coefficient based on the above parameters , ;
[0022] Step C4: Calculate the calibration coefficient based on the above parameters , ,in , , All are Nuttall's four third-order calculations constant of the coefficient;
[0023] Step C5, calculate the frequency f, .
[0024] It can be seen from the above scheme that the frequency calibration algorithms for FFT processing different window functions are different. You can choose a calibration algorithm suitable for you to calculate the frequency f according to the window function. The calibration algorithm used in this scheme is the double-peak spectrum line calibration method.
[0025] A preferred solution is that the value of the data extraction number m in step S6 must satisfy m>=n and be a divisor of the current frequency resolution fp.
[0026] It can be seen from the above scheme that when setting the data extraction number m, the extraction number is limited to a common divisor of the sampling rate, thereby ensuring that the sampling rate after data extraction is an integer.
[0027] A preferred solution is that the method for performing secondary signal acquisition based on the adjusted data extraction number m in step S6 is specifically as follows: m data are read each time the signal is read, and the last data read out of the m data is saved in the memory, and after completing N times of data saving, new N signal data are obtained.
[0028] It can be seen from the above scheme that the actual amount of data read is N*m by adjusting the data extraction number m. The last data obtained each time the signal is read is taken, and the stable value after multiple readings is taken to obtain more accurate sampling data. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0030] like Figure 1 As shown, in this embodiment, the present invention includes the following steps:
[0031] Step S1, setting a fixed sampling rate Fs for the analog-to-digital converter for sampling and setting the deviation ratio to k;
[0032] Step S2, during the initial sampling, the data extraction number m is set to 1, and no processing is performed on the data sampled by the analog-to-digital converter;
[0033] Step S3, performing initial signal acquisition, reading N data sampled by the analog-to-digital converter and storing them in a memory;
[0034] Step S4, after the storage is completed, the N data are subjected to windowing processing and then FFT operation processing to generate N complex data, and the main frequency f1 of the input signal is calculated according to the sampling rate Fs of the analog-to-digital converter, the N complex data, the data extraction number m and the calibration algorithm of the window function;
[0035] Step S5: Let the multiple relationship between the main frequency f1 of the input signal and the current frequency resolution fp be x, and x = f1 / fp, fp = Fs / N. Calculate the value of the current multiple relationship x according to the main frequency f1 of the input signal, and compare the value of the multiple relationship x with the set deviation ratio k value;
[0036] Step S6: When x < k, adjust the data extraction number m according to the main frequency f1 of the input signal obtained by the initial sampling, the initial sampling data number N, the set deviation ratio k, and the current frequency resolution fp. The value of the data extraction number m is obtained according to the intermediate variable n, n = (fp * k) / (N * f1). At the same time, perform secondary signal acquisition according to the adjusted data extraction number m, and obtain new N data. After performing windowing processing on the new N data, perform FFT operation processing to generate new N complex-form data. Among them, the method of performing secondary signal acquisition according to the adjusted data extraction number m is specifically as follows: Read m data each time the signal is read, and save the last read data among the m data read each time to the memory. After completing N data saves, obtain new N signal data;
[0037] Step S7: Calculate the main frequency f2 of the input signal according to the sampling rate Fs of the analog-to-digital converter, the new N complex-form data, the data extraction number m, and the calibration algorithm of the window function;
[0038] Step S8: Calculate the value of the current multiple relationship x according to the adjusted main frequency f2 of the input signal, and compare the value of the multiple relationship x with the set deviation ratio k value. When the value of x >= k, it means that the frequency resolution reaches the set range and output the measurement result, otherwise return to Step S6.
[0039] In this embodiment, in Steps S4 and S7, the nuttall four-term third-order window function is selected, so as to realize that the sidelobe attenuation of thd + n can be < -80dB.
[0040] In addition, in Steps S4 and S7, the window function with corresponding performance can be freely selected according to the audio signal parameters to be measured. The example window functions are shown in Table 1:
[0041] ;
[0042] In this embodiment, the calibration algorithm for calculating the frequency of the nuttall four-term third-order window function includes the following steps:
[0043] Step C1: After the data is processed by FFT operation, it is N complex-form data x + yj. Calculate the modulus p of the N complex data; ; Among them, x in the complex-form data x + yj represents the real part of the complex-form data, and y represents the imaginary part of the complex-form data;
[0044] Step C2: Find the data with the largest modulus value The data with the second largest modulus value And the data corresponds to the sequential position in N data and ;
[0045] Step C3: Calculate the calibration coefficient based on the above parameters , ;
[0046] Step C4: Calculate the calibration coefficient based on the above parameters , ,in , , All are calculations of Nuttall's four terms of third order The constant of the coefficient, , , ;
[0047] Step C5, calculate the frequency f, .
[0048] In this embodiment, the value of the data extraction number m in step S6 must satisfy m>=n and be a divisor of the current frequency resolution fp.
[0049] Embodiment 1:
[0050] The input audio signal frequency is 20Hz, and the number of data samples N is 8192;
[0051] ;
[0052] Comparison of conventional measurement methods:
[0053] .
[0054] Embodiment 2:
[0055] The input audio signal frequency is 30Hz, and the number of data samples N is 8192;
[0056] ;
[0057] Comparison of conventional measurement methods:
[0058] .
[0059] Embodiment three:
[0060] The input audio signal frequency is 40Hz, and the number of data samples N is 8192;
[0061] ;
[0062] Comparison of conventional measurement methods:
[0063] .
[0064] Conclusion: By applying to set the sampling rate of the analog-to-digital converter, setting a deviation ratio k, and setting the data extraction number m to 1, the n data collected are subjected to windowing processing during the initial acquisition and then FFT operation processing is performed to obtain the corresponding complex data. The calibration algorithm is executed according to the acquired parameters and data to calculate the main frequency f1 of the input signal, and the multiple relationship x between the main frequency f1 of the input signal and the current frequency resolution fp is further calculated. According to the comparison result of the multiple relationship x and the set deviation ratio k, the data extraction number m is adaptively adjusted, and then the adjusted data extraction number is used for secondary sampling and screening of the sampled data, and then the function after the automatic adjustment of the parameters is used to calculate and obtain the measured value, so as to achieve adaptive improvement of the measurement resolution. The calculation resolution of FFT processing is adaptively improved when the sampling rate and the actual FFT processing calculation data volume remain unchanged, and the signal frequency detection accuracy is improved when the consumption of resources and costs are the same.
Claims
1. An audio signal measurement method for adaptively improving the frequency measurement accuracy, characterized in that, it comprises the following steps: Step S1: Set a fixed sampling rate Fs for the analog-to-digital converter for sampling and set the deviation ratio to k; Step S2: When sampling for the first time, set the data extraction number m = 1, and do not process the amount of data sampled by the analog-to-digital converter; Step S3: Perform the first signal acquisition, read N data sampled by the analog-to-digital converter and store them in the memory; Step S4: After storing, perform windowing processing on the N data and then perform FFT operation processing to generate N complex-form data, and calculate the main frequency f1 of the input signal according to the sampling rate Fs of the analog-to-digital converter, the N complex-form data, the data extraction number m, and the calibration algorithm of the window function; Step S5: Let the multiple relationship between the main frequency f1 of the input signal and the current frequency resolution fp be x, and x = f1 / fp, fp = Fs / N. Calculate the value of the current multiple relationship x according to the main frequency f1 of the input signal, and compare the value of the multiple relationship x with the set deviation ratio k value; Step S6: When x < k, adjust the data extraction number m according to the main frequency f1 of the input signal obtained by the first sampling, the number N of the first sampling data, the set deviation ratio k, and the current frequency resolution fp. The value of the data extraction number m is taken according to the intermediate variable n, n = (fp * k) / (N * f1). At the same time, perform the second signal acquisition according to the adjusted data extraction number m, and obtain new N data. Perform windowing processing on the new N data and then perform FFT operation processing to generate new N complex-form data; wherein, the value of the data extraction number m should satisfy m >= n and be a divisor of the current frequency resolution fp; Step S7: Calculate the main frequency f2 of the input signal according to the sampling rate Fs of the analog-to-digital converter, the new N complex-form data, the data extraction number m, and the calibration algorithm of the window function; Step S8: Calculate the value of the current multiple relationship x according to the adjusted main frequency f2 of the input signal, and compare the value of the multiple relationship x with the set deviation ratio k value. When x >= k, it means that the frequency resolution reaches the set range and output the measurement result, otherwise return to Step S6.
2. An audio signal measurement method for adaptively improving the frequency measurement accuracy according to claim 1, characterized in that, the window function in Step S4 and Step S7 is the Nuttall four-term third-order window function.
3. An audio signal measurement method for adaptively improving the frequency measurement accuracy according to claim 2, characterized in that, the calibration algorithm for calculating the frequency of the Nuttall four-term third-order window function comprises the following steps: Step C1. After the data is processed by FFT operation, it becomes N complex data x+yj, and the modulus p of the N complex data is obtained by calculation. ; Step C2. Find the data with the largest modulus value The data with the second largest modulus value And the data corresponds to the sequential position in N data and ; Step C3. Calculate the calibration coefficient based on the above parameters , ; Step C4. Calculate the calibration coefficient based on the above parameters , ,in , , All are Nuttall's four third-order calculations constant of the coefficient; Step C5. Calculate the frequency f, .
4. An audio signal measurement method for adaptively improving the frequency measurement accuracy according to claim 1, characterized in that, the method for performing the second signal acquisition according to the adjusted data extraction number m in Step S6 is specifically: read m data each time when reading the signal, and save the last read data among the m data read each time to the memory. After completing the storage of N data, new N signal data are obtained.
Citation Information
Patent Citations
Signal spectral line analysis method and device based on FFT
CN110377873A
Double-spectral-line interpolation DFT harmonic analysis method and system based on spectral resolution self-adaption and medium
CN111308199A
