Fixed frequency audio fast resolution method
By employing a fixed-frequency audio fast parsing method, combined with signal preprocessing and FFT analysis, audio anomalies can be automatically detected. This solves the problem of low efficiency in existing audio analysis technologies, achieving efficient and accurate audio anomaly detection, especially packet loss detection, which is suitable for real-time analysis scenarios.
Patent Information
- Application Number
- CN202411708016.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-11-26
AI Technical Summary
Existing audio analysis technologies rely on manual operation and cannot efficiently analyze multiple audio data sets. Especially when detecting audio anomalies, they cannot meet the need for quickly locating audio anomalies. In particular, when the amount of audio data is large, manual detection is inefficient and it is difficult to quickly output complete analysis results.
A fixed-frequency audio fast analysis method is adopted. Through signal preprocessing, Hanning window weighting, Fast Fourier Transform (FFT), and frequency domain energy analysis, anomalies in audio signals are automatically detected. By extracting audio files and filtering their formats, the audio is preprocessed using the Hanning window function to reduce spectral leakage and ensure the accuracy of FFT processing. After converting to the frequency domain, the energy distribution is calculated, the frequency range with the maximum energy is determined, and compared with a preset threshold to automatically identify audio anomalies.
It achieves efficient and accurate audio anomaly analysis, especially packet loss detection, avoiding the inefficiency and errors of manual analysis, improving the efficiency and accuracy of audio anomaly diagnosis, and is suitable for real-time analysis scenarios.
Smart Images

Figure CN119724225B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of audio analysis technology, and in particular to a method for fast parsing of fixed-frequency audio. Background Technology
[0002] With the rapid development of audio technology and digital signal processing technology, audio data analysis has become an important part of fields such as speech recognition, audio monitoring, and music analysis. Through in-depth analysis of audio signals, key information can be effectively extracted, meeting the precise audio processing needs of various application scenarios and demonstrating broad application prospects.
[0003] Existing audio analysis techniques typically rely on specialized tools or software to convert audio signals into spectrograms. Anomalies or specific features in the audio are then identified through manual observation and analysis of these spectrograms. For example, a common method involves using specific tools to convert the audio file format, generate a spectrogram, and then locate the time-frequency relationships in the audio. Some tools can also extract audio characteristics using basic algorithms to assist in manual analysis.
[0004] However, current technologies primarily rely on manual operation, which cannot meet the needs of efficiently analyzing multiple audio segments and quickly locating audio anomalies. When the amount of audio data is large, manual detection is inefficient and struggles to quickly output complete analysis results. Summary of the Invention
[0005] This application provides a fast fixed-frequency audio parsing method that ensures high-precision and high-efficiency audio anomaly analysis without relying on manual intervention. The technical solution provided in this application is as follows:
[0006] In a first aspect, this application provides a method for fast parsing of fixed-frequency audio, the method comprising:
[0007] Extract the audio to be parsed;
[0008] The extracted audio to be parsed is parsed, audio samples are prepared and preprocessed;
[0009] Perform a Fast Fourier Transform on the preprocessed audio samples and calculate the frequency domain energy;
[0010] Calculate the frequency range where the energy is maximum based on the sample frequency;
[0011] Traverse the frequency domain energy to determine if there is packet loss in the audio sample; if the frequency domain energy value before the calculated frequency point interval exceeds the preset threshold, the audio sample is considered to have packet loss.
[0012] In one specific implementation, the extraction of the audio to be parsed includes:
[0013] Enter the directory path of the audio file to be parsed and the audio file format to be parsed;
[0014] Recursively traverse the specified root directory to obtain all files and subdirectory paths under that directory;
[0015] Perform regular expression matching on the obtained file list to filter out files that conform to the predetermined audio file format, and output a list of audio file paths that meet the conditions.
[0016] In one specific implementation scheme, the recursive traversal of the specified root directory includes:
[0017] Use the os.walk function from the Python standard library to recursively traverse a specified root directory.
[0018] In one specific implementation, preparing and preprocessing the audio samples includes:
[0019] Select audio samples of length N from the extracted audio files, where N is a pre-defined sample length;
[0020] The audio samples are weighted using the Hanning window function, and the processed audio sample data is divided into N equal parts.
[0021] Output the processed audio sample data.
[0022] In one specific implementation, performing a Fast Fourier Transform on the preprocessed audio samples and calculating the frequency domain energy includes:
[0023] Convert the preprocessed audio samples from the time domain to the frequency domain;
[0024] Perform a fast Fourier transform on the converted frequency domain data to obtain the amplitude information of the signal at different frequencies;
[0025] By calculating the absolute value of the Fast Fourier Transform result, the energy distribution of the audio signal at each frequency is obtained, and the frequency domain energy data of the audio signal is output.
[0026] In one specific implementation, the frequency range at which the energy is maximized based on the sample frequency includes:
[0027] Calculate the actual frequency range corresponding to each frequency point based on the sampling frequency of the audio signal;
[0028] Based on the frequency domain energy distribution, identify the frequency range where the energy is maximum.
[0029] In a specific implementation, the step of traversing the frequency domain energy to determine whether there is a packet loss problem in the audio sample; if the frequency domain energy value before the calculated frequency point interval exceeds a preset threshold, then the audio sample is considered to have a packet loss problem, including:
[0030] Traverse the frequency domain energy data of the audio samples and check the energy value at each frequency point;
[0031] If the energy of a frequency point exceeds a preset threshold and the frequency point is located before the frequency range, it is determined that there is a packet loss problem in the audio sample.
[0032] Output the packet loss judgment result to indicate whether there is a packet loss problem.
[0033] Secondly, this application provides a fixed-frequency audio fast analysis system, which adopts the following technical solution:
[0034] A fixed-frequency audio fast analysis system, comprising:
[0035] The audio extraction module is used to extract the audio to be parsed.
[0036] The audio processing module is used to perform audio parsing on the extracted audio to be parsed, prepare audio samples and preprocess them;
[0037] The energy calculation module is used to perform a fast Fourier transform on the preprocessed audio samples and calculate the frequency domain energy.
[0038] The interval calculation module is used to calculate the frequency interval where the energy is maximum based on the sample frequency.
[0039] The audio parsing module is used to traverse the frequency domain energy and determine whether there is a packet loss problem in the audio sample. If the frequency domain energy value before the calculated frequency point interval exceeds the preset threshold, the audio sample is considered to have a packet loss problem.
[0040] Thirdly, this application provides an electronic device, the device including a processor and a memory; the memory stores a program, the program being loaded and executed by the processor to implement a fixed-frequency audio fast parsing method as described in the first aspect.
[0041] Fourthly, this application provides a computer-readable storage medium storing a program that, when executed by a processor, is used to implement a fixed-frequency audio fast parsing method as described in the first aspect.
[0042] In summary, the beneficial effects of this application include at least the following:
[0043] 1) By combining signal preprocessing, Hanning window weighting, Fast Fourier Transform (FFT), and frequency domain energy analysis, this application can efficiently and accurately detect anomalies in audio signals (such as packet loss, amplitude clipping, distortion, etc.). This process does not rely on manual intervention, ensuring high-precision and high-efficiency audio anomaly analysis.
[0044] 2) It can perform fully automatic frequency domain analysis on the extracted audio data without manual intervention, which significantly improves the efficiency and accuracy of audio anomaly diagnosis and avoids errors and inefficiencies in the manual analysis process.
[0045] 3) Users can expand the functionality according to specific needs, such as adding detection of other types of audio anomalies (such as echo, distortion, etc.), or combining other algorithms to further improve detection accuracy and adapt to different industry applications.
[0046] By extracting the audio file to be parsed and filtering its format, audio samples that meet the criteria are obtained. Next, the extracted audio is preprocessed using the Hanning window function to reduce spectral leakage and ensure the accuracy of the FFT processing. Then, the audio signal is converted from the time domain to the frequency domain using a Fast Fourier Transform (FFT), and the energy distribution of the audio signal in the frequency domain is calculated to locate the frequency components of the signal. Subsequently, by analyzing the frequency domain energy, the frequency range where the energy is maximum is calculated and compared with a preset threshold to determine if there are any anomalies, such as packet loss. If an energy peak exceeding the threshold is found before the normal range of frequency domain energy, the system will automatically identify it as a possible packet loss phenomenon and output the detection result. This method solves the problems of insufficient accuracy and low efficiency in audio anomaly detection in existing technologies. Through efficient audio sample processing, spectral analysis, and automated packet loss detection, the accuracy and processing speed of audio anomaly detection are greatly improved, avoiding the shortcomings and inefficiencies of traditional manual analysis methods, making it particularly suitable for application scenarios requiring real-time audio signal analysis.
[0047] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, the preferred embodiments of this application are described in detail below with reference to the accompanying drawings. Attached Figure Description
[0048] Figure 1 This is a schematic diagram of the process for extracting the audio to be parsed in an embodiment of this application.
[0049] Figure 2 This is a schematic diagram illustrating the process of audio parsing of the extracted audio to be parsed in an embodiment of this application.
[0050] Figure 3 This is a structural block diagram of the fixed-frequency audio fast parsing system in the embodiments of this application.
[0051] Figure 4 This is a block diagram of an electronic device for fast parsing of fixed-frequency audio in an embodiment of this application. Detailed Implementation
[0052] The specific embodiments of this application will be described in further detail below with reference to the accompanying drawings and examples. The following examples are used to illustrate this application, but are not intended to limit the scope of this application.
[0053] Optionally, this application uses the fixed frequency audio fast parsing method provided in various embodiments in an electronic device as an example for illustration. The electronic device is a terminal or a server. The terminal can be a computer, tablet computer, etc. This embodiment does not limit the type of electronic device.
[0054] This application provides a method for fast parsing of fixed-frequency audio, which includes at least the following steps:
[0055] Step S101: Extract the audio to be parsed.
[0056] In step S101, Figure 1 The diagram illustrates the process of extracting audio to be parsed in this embodiment of the application. First, the directory path of the audio file to be parsed and the audio file format to be parsed are input through a tool interface or script configuration file. Then, the `os.walk` function from the Python standard library recursively traverses the user-specified root directory, obtaining all files and subdirectory paths within the directory level by level. Each item returned by the `os.walk` function includes the current directory path, a list of subdirectories, and a list of files in the current directory. Finally, during the traversal, regular expressions are used to match the obtained file list, filtering out audio files that meet the input file extension criteria. The program ultimately outputs a list containing all audio file paths that meet the criteria; this list will serve as input data for subsequent audio processing and analysis.
[0057] Step S102: Perform audio parsing on the extracted audio to be parsed, prepare audio samples and preprocess them.
[0058] In step S102, Figure 2 This illustration shows a flowchart of the audio parsing process for the extracted audio file in this embodiment of the application. The extracted audio file is processed to prepare audio samples, which are then preprocessed and converted into a data format suitable for spectral analysis. Audio samples of length N are extracted, processed by the Hanning window function, and then divided into N equal parts.
[0059] Specifically, audio samples of length N are selected from the extracted audio files, where N is a pre-defined sample length. The choice of audio sample length affects the accuracy and efficiency of frequency domain analysis. During each analysis, a time-domain signal of the corresponding length is extracted from the audio file to prepare for subsequent frequency domain processing. The Hanning window function is then applied to the audio samples for weighting to reduce spectral leakage caused by signal truncation. FFT can only process time-domain signals of finite length, thus requiring signal truncation. Since the truncated signal is not a periodic integer multiple, spectral leakage may occur. The Hanning window function, by smoothly weighting the signal, reduces this leakage, ensuring the accuracy of the frequency domain analysis. Finally, the processed audio sample data is divided equally to ensure that the data length of each segment is suitable for subsequent Fast Fourier Transform (FFT) execution. The equally divided data will serve as input for FFT analysis, helping to improve the accuracy and efficiency of the analysis.
[0060] Step S103: Perform a fast Fourier transform on the preprocessed audio samples and calculate the frequency domain energy.
[0061] In step S103, the preprocessed audio samples are converted from the time domain to the frequency domain, and the energy distribution of the audio signal in the frequency domain is calculated to provide basic data for subsequent analysis of audio anomalies.
[0062] Specifically, the audio sample data is weighted using the Hanning window function and then segmented into multiple sub-segments. Next, a Fast Fourier Transform (FFT) is applied to these sample data. FFT is an efficient algorithm that converts a time-domain signal into a frequency-domain signal, transforming the signal from a time coordinate system to a frequency coordinate system. Audio signals are composed of the superposition of multiple sound waves of different frequencies; FFT can use mathematical algorithms to separate these frequency components and obtain the amplitude of the signal at each frequency.
[0063] In practice, since the output of the FFT is typically a complex number, representing the amplitude and phase information of the signal at different frequencies, the energy in the frequency domain needs to be obtained by taking the absolute value of the FFT result. The resulting spectrum represents the energy of the audio signal at each frequency, i.e., the amplitude information in the frequency domain. This frequency domain data effectively reflects the frequency characteristics of the audio signal and can be used for subsequent analysis, such as packet loss or other anomaly detection. Further statistical analysis can be performed on the frequency domain data after taking the absolute value to obtain the energy distribution at each frequency point. This energy data will serve as the basis for subsequent detection of audio anomalies (such as packet loss, signal distortion, etc.). If the energy exceeds a certain threshold within a specific frequency range, it can be determined that the audio signal in that frequency band is abnormal. The energy distribution can also help identify changes in different frequency components in the audio, further evaluating the audio quality.
[0064] In step S103, the audio signal is transformed from the time domain to the frequency domain, and energy information in the frequency domain is obtained. This data will become the key basis for subsequent judgment of audio anomalies (such as packet loss, distortion, etc.). This step is one of the core steps for audio analysis tools to achieve efficient and accurate analysis.
[0065] Step S104: Calculate the frequency range where the energy is maximum based on the sample frequency.
[0066] In step S104, the actual frequency range corresponding to each frequency point is first calculated based on the sampling frequency of the audio signal. Then, according to the distribution of frequency domain energy, the frequency band containing the frequency point with the highest energy is identified. The intervals containing these frequency points reflect the main frequency components of the audio signal. By analyzing these frequency intervals, possible audio anomalies, such as packet loss, can be further located.
[0067] Specifically, the frequency range corresponding to each frequency point is determined by the audio sampling frequency and FFT results. The frequency band where the peak energy in the frequency domain is located is found, which is the frequency region with the strongest energy in the signal. By comparing these frequency point intervals with preset thresholds, the presence of anomalies (such as packet loss, amplitude clipping, etc.) in the audio signal is detected.
[0068] Step S105: Traverse the frequency domain energy to determine if there is packet loss in the audio sample. If the frequency domain energy value before the calculated frequency interval exceeds a preset threshold, the audio sample is considered to have packet loss.
[0069] In step S105, firstly, the frequency domain energy of the audio samples is traversed to check if the energy value exceeds a preset threshold. The threshold is set based on experience or requirements and is used to distinguish between normal signals and potentially abnormal signals. If the energy at a certain frequency point exceeds the threshold, and this frequency point is located before the expected frequency range, it means there is an abnormal energy peak near that frequency band, which may be a sign of packet loss or other anomalies. If the frequency domain energy of the audio signal before the expected frequency range exceeds the threshold, it is determined that there is a packet loss problem in the audio sample. Packet loss problems usually cause abnormal energy distribution in the spectrum, especially outside the expected frequency range, where the signal strength is abnormal. Finally, the packet loss determination result is output and provided to the user to inform them whether a packet loss problem exists, aiding in subsequent analysis and processing.
[0070] During this process, the frequency domain energy data of the audio samples are examined one by one, with particular attention paid to whether any prominent energy peaks are found outside the predetermined frequency range. This can serve as an important indicator of packet loss. Through this analysis, the system can automatically identify potential packet loss problems in the audio, thereby achieving rapid location and processing, avoiding the inefficiency and errors of manual analysis.
[0071] In summary, by extracting the audio file to be parsed and filtering its format, audio samples meeting the criteria are obtained. Next, the Hanning window function is used to preprocess the extracted audio, reducing spectral leakage and ensuring the accuracy of the FFT processing. Then, the audio signal is converted from the time domain to the frequency domain using a Fast Fourier Transform (FFT), and the energy distribution of the audio signal in the frequency domain is calculated to locate the frequency components of the signal. Subsequently, by analyzing the frequency domain energy, the frequency range where the energy is maximum is calculated and compared with a preset threshold to determine if there are any anomalies, such as packet loss. If an energy peak exceeding the threshold is found before the normal range of frequency domain energy, the system will automatically identify it as a possible packet loss phenomenon and output the detection result. This method solves the problems of insufficient accuracy and low efficiency in audio anomaly detection in existing technologies. Through efficient audio sample processing, spectral analysis, and automated packet loss detection, the accuracy and processing speed of audio anomaly detection are greatly improved, avoiding the shortcomings and inefficiencies of traditional manual analysis methods, making it particularly suitable for application scenarios requiring real-time audio signal analysis.
[0072] Furthermore, users can expand the functionality based on specific needs, such as adding detection of other types of audio anomalies (echo, distortion, etc.), or combining other algorithms to further improve detection accuracy and adapt to different industry applications.
[0073] Figure 3 This is a structural block diagram of a fixed-frequency audio fast parsing system provided in one embodiment of this application. The system includes at least the following modules:
[0074] The audio extraction module is used to extract the audio to be parsed.
[0075] The audio processing module is used to perform audio parsing on the extracted audio to be parsed, prepare audio samples and preprocess them;
[0076] The energy calculation module is used to perform a fast Fourier transform on the preprocessed audio samples and calculate the frequency domain energy.
[0077] The interval calculation module is used to calculate the frequency interval where the energy is maximum based on the sample frequency.
[0078] The audio parsing module is used to traverse the frequency domain energy and determine whether there is a packet loss problem in the audio sample. If the frequency domain energy value before the calculated frequency point interval exceeds the preset threshold, the audio sample is considered to have a packet loss problem.
[0079] For relevant details, please refer to the above method implementation examples.
[0080] Figure 4 This is a block diagram of an electronic device provided in one embodiment of this application. The device includes at least a processor 401 and a memory 402.
[0081] Processor 401 may include one or more processing cores, such as a quad-core processor or an octa-core processor. Processor 401 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 401 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 401 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 401 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0082] The memory 402 may include one or more computer-readable storage media, which may be non-transitory. The memory 402 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 402 are used to store at least one instruction, which is executed by the processor 401 to implement the fixed-frequency audio fast parsing method provided in the method embodiments of this application.
[0083] In some embodiments, the electronic device may also optionally include: a peripheral device interface and at least one peripheral device. The processor 401, memory 402, and peripheral device interface can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface via a bus, signal line, or circuit board. Indicatively, peripheral devices include, but are not limited to: radio frequency circuitry, a touch display screen, audio circuitry, and a power supply.
[0084] Of course, electronic devices may also include fewer or more components, and this embodiment does not limit this.
[0085] Optionally, this application also provides a computer-readable storage medium storing a program that is loaded and executed by a processor to implement the fixed-frequency audio fast parsing method of the above method embodiments.
[0086] Optionally, this application also provides a computer product including a computer-readable storage medium storing a program that is loaded and executed by a processor to implement the fixed-frequency audio fast parsing method of the above-described method embodiments.
[0087] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0088] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A fixed frequency audio fast resolution method, characterized by, The method comprises: extracting audio to be parsed; performing audio analysis on the extracted audio to be parsed, preparing audio samples and pre-processing them; performing fast Fourier transform on the pre-processed audio samples and calculating frequency domain energy; calculating the frequency point interval at which the energy is maximum according to the sample frequency; traversing the frequency domain energy to determine whether there is a packet loss problem in the audio sample; if the frequency domain energy value before the calculated frequency point interval exceeds the preset threshold value, it is considered that the audio sample has a packet loss problem.
2. The fixed frequency audio fast resolution method of claim 1, wherein, The extraction of the audio to be parsed comprises: inputting the directory path of the audio to be parsed and the audio file format to be parsed; recursively traversing the specified root directory to obtain all files and subdirectory paths under the directory; performing regular expression matching on the obtained file list to filter out files that meet the predetermined audio file format, and outputting the audio file path list that meets the conditions.
3. The fixed frequency audio fast resolution method of claim 2, wherein, The recursive traversal of the specified root directory comprises: recursively traversing the specified root directory using the os.walk function in the Python standard library.
4. The fixed frequency audio fast resolution method of claim 1, wherein, The preparation of the audio samples and the pre-processing thereof comprises: selecting audio samples of length N from the extracted audio file, wherein N is a pre-set sample length; applying Hann window function weighting processing to the audio samples, dividing the processed audio sample data into N equal parts; outputting the processed audio sample data.
5. The fixed frequency audio fast resolution method of claim 1, wherein, The fast Fourier transform on the pre-processed audio samples and the calculation of the frequency domain energy comprise: converting the pre-processed audio samples from the time domain to the frequency domain; performing fast Fourier transform on the converted frequency domain data to obtain the amplitude information of the signal at different frequencies; by calculating the absolute value of the fast Fourier transform result, the energy distribution of the audio signal at each frequency is obtained, and the frequency domain energy data of the audio signal is outputted.
6. The fixed frequency audio fast resolution method of claim 1, wherein, The calculation of the frequency point interval at which the energy is maximum according to the sample frequency comprises: calculating the actual frequency interval corresponding to each frequency point according to the sampling frequency of the audio signal; based on the frequency domain energy distribution, finding the frequency point interval at which the energy is maximum.
7. The fixed frequency audio fast resolution method of claim 1, wherein, The traversal of the frequency domain energy to determine whether there is a packet loss problem in the audio sample; if the frequency domain energy value before the calculated frequency point interval exceeds the preset threshold value, it is considered that the audio sample has a packet loss problem, which comprises: traversing the frequency domain energy data of the audio sample to check the energy value of each frequency point; judging that the audio sample has a packet loss problem when the energy of the frequency point exceeds the preset threshold value and the frequency point is located before the frequency point interval; outputting the packet loss judgment result to indicate whether there is a packet loss problem.
8. A fixed frequency audio fast resolution system characterized by, It comprises: an audio extraction module for extracting audio to be parsed; an audio processing module for performing audio analysis on the extracted audio to be parsed, preparing audio samples and pre-processing them; an energy calculation module for performing fast Fourier transform on the pre-processed audio samples and calculating frequency domain energy; an interval calculation module for calculating the frequency point interval at which the energy is maximum according to the sample frequency; an audio analysis module for traversing the frequency domain energy to determine whether there is a packet loss problem in the audio sample; if the frequency domain energy value before the calculated frequency point interval exceeds the preset threshold value, it is considered that the audio sample has a packet loss problem.
9. An electronic device, comprising: The device comprises a processor and a memory; the memory stores a program, which is loaded and executed by the processor to implement the fixed frequency audio fast resolution method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a program, which is executed by the processor to implement the fixed frequency audio fast resolution method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Vibration distortion-based voice frequency objective quality evaluating method and system
CN103050128A
Audio popping detection method and device
CN109903775A