Audio file processing method, device and storage medium
Through the audio file processing method, the original data is converted into a two-dimensional array for browser-side rendering and various analyses, which solves the problem of chaotic file management on the audio processing platform and realizes efficient audio processing and management.
Patent Information
- Application Number
- CN202411730686.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2044-11-29
Smart Images

Figure CN119669510B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of acoustic processing, and in particular to an audio file processing method, device and storage medium. Background Art
[0002] In existing audio processing, audio files are processed through specific steps and lack processing on a unified platform. When there are many processing methods and process files generated, it is difficult to manage the processing result files and process files, resulting in chaotic file management and affecting processing efficiency. Summary of the Invention
[0003] The present invention provides an audio file processing method, device and storage medium, aiming to solve at least one of the technical problems existing in the prior art.
[0004] The technical solution of the present invention is an audio file processing method, which is applied to an audio file processing device. The audio file processing device at least includes: an original data module; a back-end module, the back-end module includes a data conversion module and a data storage module, the data conversion module is connected to the original data module; a front-end module, the front-end module includes a waveform rendering module, a waveform data processing module and a spectrum analysis module, the waveform rendering module is connected to the data conversion module, and the waveform processing module and the spectrum analysis module are respectively connected to the data storage module. The audio file processing method includes the following steps:
[0005] S100, the data conversion module converts the original data file into waveform data of a two-dimensional array;
[0006] S200, the waveform rendering module renders the waveform data of the two-dimensional array on the browser front end based on the Uplot graphics rendering component and the Canvas drawing component;
[0007] S300, based on a plurality of preset waveform data processing methods, the waveform data processing module processes the waveform data of the two-dimensional array, displays the processed waveform on the front end of the browser and records the processing process;
[0008] S400, based on the spectrum analysis module, performing waveform analysis on the waveform data of the two-dimensional array and displaying the corresponding chart on the front end of the browser, wherein the waveform analysis includes at least a fast Fourier transform (FFT) analysis method, a THD+N Radio analysis method, an RMS Level analysis method, and a CPB analysis method;
[0009] For the Fast Fourier Transform (FFT) analysis method, the waveform data of the input two-dimensional array is divided into an even-indexed sequence and an odd-indexed sequence. Then, the DFT calculation is performed on the even-indexed sequence and the odd-indexed sequence respectively. The FFT calculation is recursively performed on the even-indexed sequence and the odd-indexed sequence after the DFT calculation. The results of the even-indexed sequence and the odd-indexed sequence after the Fast Fourier Transform (FFT) calculation are combined using a butterfly operation as a rotation factor.
[0010] For the THD+N Radio analysis method, a bandpass filter is used to extract the fundamental signal portion of the waveform data of the two-dimensional array; the fundamental signal portion is removed from the waveform data of the two-dimensional array to calculate the residual signal portion, wherein the residual signal portion includes harmonic distortion and noise; a fast Fourier transform (FFT) calculation is performed on the residual signal portion to obtain frequency domain data of the residual signal portion, and all harmonic components and noise in the frequency band in the frequency domain data of the residual signal portion are found and marked; the amplitudes V1, V2, V3, ... and Vn of all harmonic distortion components and the total amplitude Vnoise of the noise are calculated using the frequency domain data of the residual signal portion; and the THD+N value is calculated, wherein,
[0011] ;
[0012] For the RMS Level analysis method, the waveform data of the two-dimensional array is sampled; the RMS of the waveform data of the two-dimensional array is calculated, where
[0013] ,
[0014] Where x[n] represents the nth sample value in the data sequence, and N represents the total number of samples in the data sequence. Based on the RMS and the reference voltage, the RMS is calculated, where
[0015] ,
[0016] Where Vref is the reference voltage used to define the base of the signal level, and the constant 20 is used to convert the RMS ratio to decibel dB.
[0017] For the CPB analysis method, the fast Fourier transform (FFT) is used to convert the waveform data of the two-dimensional array in the time domain into frequency domain data. The frequency domain data is converted to the Bark frequency representation through the Bark frequency scale to align with the auditory perception model of the human ear. According to the Bark frequency scale, the frequency domain data is divided into 24 frequency bands of non-uniform width, each of which corresponds to a critical frequency band of the human ear, with the low frequency band being narrower and the high frequency band being wider. The total energy of all frequency components within each critical frequency band is calculated.
[0018] S500, saving the waveform data and the operation process as MDF file data, and storing it in the back-end data storage module;
[0019] The process of generating an MDF file is as follows: collecting multiple waveform data files and assigning identifiers to the multiple waveform data files respectively; creating a description file and writing the parsing methods and mutual relationships of the multiple waveform data files into the description file according to a predefined data structure; encrypting the multiple waveform data files and the description file through a symmetric encryption algorithm; creating a master file and writing the file names, ID numbers, types, encryption configuration information and keys of the multiple waveform data files and the description file into the data file information segment of the master file respectively; writing the application type into the application type information segment of the master file; asymmetrically encrypting the master file through a public key; and compressing the multiple waveform data files, the description file and the master file through zip to obtain a compressed file.
[0020] Furthermore, the step S100 includes:
[0021] S110, the data conversion module reads the format of the original data file and identifies the type of the original data file based on automatic recognition or user selection;
[0022] S120, matching a corresponding interpreter according to the type of the original data file;
[0023] S130 , calling an interpreter to interpret the data in the original data file to obtain interpreted data, wherein the interpreted data at least includes waveform data of a two-dimensional array, a sampling rate, a time length, and deviation correction data.
[0024] Furthermore, the step S200 includes:
[0025] S210, obtaining the pixel size of the area displayed on the browser front end and the range of the waveform display;
[0026] S220, resample the waveform data of the two-dimensional array to obtain a time period entry value and a time period exit value corresponding to each pixel of the x-axis in the browser front-end display area;
[0027] S230, calculating the y-axis position corresponding to each pixel point on the x-axis in the display area of the browser front end based on the display y-axis range set by the browser front end;
[0028] S240: Create a Path object to be rendered, pass the Path object into the Canvas drawing component, and display it on the front end of the browser.
[0029] Furthermore, in step S300,
[0030] The preset multiple waveform data processing methods include at least high-pass filtering, low-pass filtering, band-pass filtering and Moving smoothing.
[0031] Furthermore, if high-pass filtering is selected, step S300 includes:
[0032] S310, determining the cutoff frequency Fc;
[0033] S311, determining the type and parameters of a filter, where the filter types include a finite impulse response filter FIR and an infinite impulse response filter IIR;
[0034] S312, performing a Fourier transform operation on the discrete two-dimensional array waveform data signal to convert the two-dimensional array waveform data signal from the time domain to the frequency domain to obtain a frequency domain signal;
[0035] S313. In the frequency domain, use a high-pass filter to filter the frequency domain signal to retain frequency components higher than the cutoff frequency Fc;
[0036] S314, performing inverse Fourier transform on the filtered frequency domain signal to obtain a filtered time domain signal;
[0037] If low-pass filtering is selected, step S300 includes:
[0038] S320, determining the cutoff frequency Fc;
[0039] S321, determining the type and parameters of a filter, where the filter types include a finite impulse response filter FIR and an infinite impulse response filter IIR;
[0040] S322, performing a Fourier transform operation on the discrete two-dimensional array waveform data signal to convert the two-dimensional array waveform data signal from the time domain to the frequency domain to obtain a frequency domain signal;
[0041] S323. In the frequency domain, use a low-pass filter to filter the frequency domain signal to retain frequency components below the cutoff frequency Fc;
[0042] S324, performing an inverse Fourier transform on the filtered frequency domain signal to obtain a filtered time domain signal;
[0043] If bandpass filtering is selected, step S300 includes:
[0044] S330, determining the center frequency Fc and the bandwidth BW;
[0045] S331, determining the type and parameters of a filter, where the filter types include Butterworth filter and Chebyshev filter;
[0046] S332, calculating the filter order n based on the stopband attenuation AdB, the passband ripple Ap, the upper cutoff frequency f1 and the lower cutoff frequency f2;
[0047] S333, according to the selected filter type and order n, the filter coefficients are calculated through a lookup table, and finally the filter transfer function f is realized;
[0048] S334, filtering the discrete two-dimensional array waveform data signal according to the filter transfer function f;
[0049] If Moving smoothing is selected, step S300 includes:
[0050] S340, determining the moving window size n;
[0051] S341, based on the simple average SAM, realize the filter function f,
[0052] Among them, SAM=(x1+x2+x3 … + xn) / n,
[0053] Where x1, x2, x3, …, xn is a set of audio data sample values, and n is the number of samples;
[0054] S342. Use the filter function f to traverse the waveform data signal of the discrete two-dimensional array to obtain a filtered signal.
[0055] Furthermore, in step S500, the backend data storage module stores the data including:
[0056] Source file data and file index data, the source file data is stored in the OSS file storage database, and the file index data is stored in the project database.
[0057] Furthermore, the present invention also provides an audio file processing device for executing the audio file processing method. The audio file processing device at least comprises:
[0058] Raw data module;
[0059] A back-end module, comprising a data conversion module and a data storage module, wherein the data conversion module is connected to the original data module;
[0060] The front-end module includes a waveform rendering module, a waveform data processing module and a spectrum analysis module. The waveform rendering module is connected to the data conversion module, and the waveform processing module and the spectrum analysis module are respectively connected to the data storage module.
[0061] Furthermore, the present invention also provides a computer-readable storage medium having program instructions stored thereon, wherein the program instructions implement the audio file processing method when executed by a processor.
[0062] The beneficial effects of the present invention are:
[0063] The audio file processing method, device and storage medium perform audio processing on a unified platform and perform standardized management of processing process files and result files, thereby improving processing efficiency and reusability. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 The figure is an overall flow chart of the audio file processing method.
[0065] Figure 2 Schematic diagram of the module structure of the audio file processing device.
[0066] Figure 3 A schematic diagram of the MDF file structure in the audio file processing method.
[0067] Figure 4 A schematic diagram comparing audio file processing methods for simultaneously importing waveform files of different formats.
[0068] Figure 5 A schematic diagram of automatically identifying audio file formats in an audio file processing method.
[0069] Figure 6 Schematic diagram of a user manually selecting an interpreter in an audio file processing method.
[0070] Figure 7 This is a diagram of the two-dimensional array data read from the audio file in the audio file processing method.
[0071] Figure 8 This is a schematic diagram of the waveform data of a two-dimensional array rendered on the browser front end by the waveform rendering module in the audio file processing method.
[0072] Figure 9 This is a schematic diagram of the waveform data processing module in the audio file processing method using a high-pass filtering method to process waveform data in a two-dimensional array.
[0073] Figure 10 This is a schematic diagram of the waveform data processing module in the audio file processing method using a low-pass filtering method to process waveform data in a two-dimensional array.
[0074] Figure 11 Schematic diagram of the waveform data processing module in the audio file processing method using a bandpass filtering method to process waveform data in a two-dimensional array.
[0075] Figure 12Schematic diagram of the waveform data processing module in the audio file processing method using the Moving smoothing method to process waveform data in a two-dimensional array.
[0076] Figure 13 Schematic diagram of the waveform data processing module using the fast Fourier transform (FFT) analysis method in the audio file processing method.
[0077] Figure 14 Schematic diagram of the waveform data processing module in the audio file processing method using the THD+N Radio analysis method.
[0078] Figure 15 Schematic diagram of the RMS Level analysis method used in the waveform data processing module of the audio file processing method.
[0079] Figure 16 Schematic diagram of the waveform data processing module using the CPB analysis method in the audio file processing method. DETAILED DESCRIPTION
[0080] The following will be combined with the embodiments and drawings to clearly and completely describe the concept, specific structure and technical effects of the present invention so as to fully understand the purpose, scheme and effect of the present invention. It should be noted that the embodiments and features in the embodiments of this application can be combined with each other unless there is a conflict.
[0081] It should be noted that, unless otherwise specified, when a feature is referred to as being "fixed" or "connected" to another feature, it may be directly fixed or connected to the other feature or indirectly fixed or connected to the other feature. Furthermore, terms such as "upper," "lower," "left," "right," "top," and "bottom" used in this disclosure are intended solely to describe the relative positions of the components of the disclosure as shown in the accompanying drawings.
[0082] In addition, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art. The terms used in this specification are only for describing specific embodiments and are not intended to limit the present invention. The term "and / or" as used herein includes any combination of one or more of the related listed items.
[0083] It should be understood that although the terms first, second, third, etc. may be used to describe various elements in the present disclosure, these elements should not be limited to these terms. These terms are only used to distinguish elements of the same type from each other. For example, a first element may also be referred to as a second element, and similarly, a second element may also be referred to as a first element without departing from the scope of the present disclosure.
[0084] Reference Figures 1 to 16In some embodiments, the technical solution of the present invention is an audio file processing method, which is applied to an audio file processing device. The audio file processing device at least includes: an original data module; a back-end module, the back-end module includes a data conversion module and a data storage module, the data conversion module is connected to the original data module; a front-end module, the front-end module includes a waveform rendering module, a waveform data processing module and a spectrum analysis module, the waveform rendering module is connected to the data conversion module, and the waveform processing module and the spectrum analysis module are respectively connected to the data storage module. The audio file processing method includes the following steps:
[0085] S100, the data conversion module converts the original data file into waveform data of a two-dimensional array;
[0086] S200, the waveform rendering module renders the waveform data of the two-dimensional array on the browser front end based on the Uplot graphics rendering component and the Canvas drawing component;
[0087] S300, based on a plurality of preset waveform data processing methods, the waveform data processing module processes the waveform data of the two-dimensional array, displays the processed waveform on the front end of the browser and records the processing process;
[0088] S400, based on the spectrum analysis module, performing waveform analysis on the waveform data of the two-dimensional array and displaying the corresponding chart on the front end of the browser, wherein the waveform analysis includes at least a fast Fourier transform (FFT) analysis method, a THD+N Radio analysis method, an RMS Level analysis method, and a CPB analysis method;
[0089] For the Fast Fourier Transform (FFT) analysis method, the waveform data of the input two-dimensional array is divided into an even-indexed sequence and an odd-indexed sequence. Then, the DFT calculation is performed on the even-indexed sequence and the odd-indexed sequence respectively. The FFT calculation is recursively performed on the even-indexed sequence and the odd-indexed sequence after the DFT calculation. The results of the even-indexed sequence and the odd-indexed sequence after the Fast Fourier Transform (FFT) calculation are combined using a butterfly operation as a rotation factor.
[0090] For the THD+N Radio analysis method, a bandpass filter is used to extract the fundamental signal portion of the waveform data of the two-dimensional array; the fundamental signal portion is removed from the waveform data of the two-dimensional array to calculate the residual signal portion, wherein the residual signal portion includes harmonic distortion and noise; a fast Fourier transform (FFT) calculation is performed on the residual signal portion to obtain frequency domain data of the residual signal portion, and all harmonic components and noise in the frequency band in the frequency domain data of the residual signal portion are found and marked; the amplitudes V1, V2, V3, ... and Vn of all harmonic distortion components and the total amplitude Vnoise of the noise are calculated using the frequency domain data of the residual signal portion; and the THD+N value is calculated, wherein,
[0091] ;
[0092] For the RMS Level analysis method, the waveform data of the two-dimensional array is sampled; the RMS of the waveform data of the two-dimensional array is calculated, where
[0093] ,
[0094] Where x[n] represents the nth sample value in the data sequence, and N represents the total number of samples in the data sequence. Based on the RMS and the reference voltage, the RMS is calculated, where
[0095] ,
[0096] Where Vref is the reference voltage used to define the base of the signal level, and the constant 20 is used to convert the RMS ratio to decibel dB.
[0097] For the CPB analysis method, the fast Fourier transform (FFT) is used to convert the waveform data of the two-dimensional array in the time domain into frequency domain data. The frequency domain data is converted to the Bark frequency representation through the Bark frequency scale to align with the auditory perception model of the human ear. According to the Bark frequency scale, the frequency domain data is divided into 24 frequency bands of non-uniform width, each of which corresponds to a critical frequency band of the human ear, with the low frequency band being narrower and the high frequency band being wider. The total energy of all frequency components within each critical frequency band is calculated.
[0098] S500, saving the waveform data and the operation process as MDF file data, and storing it in the back-end data storage module;
[0099] The process of generating an MDF file is as follows: collecting multiple waveform data files and assigning identifiers to the multiple waveform data files respectively; creating a description file and writing the parsing methods and mutual relationships of the multiple waveform data files into the description file according to a predefined data structure; encrypting the multiple waveform data files and the description file through a symmetric encryption algorithm; creating a master file and writing the file names, ID numbers, types, encryption configuration information and keys of the multiple waveform data files and the description file into the data file information segment of the master file respectively; writing the application type into the application type information segment of the master file; asymmetrically encrypting the master file through a public key; and compressing the multiple waveform data files, the description file and the master file through zip to obtain a compressed file.
[0100] The beneficial effects of the present invention are:
[0101] The audio file processing method, device and storage medium perform audio processing on a unified platform and perform standardized management of processing process files and result files, thereby improving processing efficiency and reusability.
[0102] Specifically, the data conversion module provides professional conversion capabilities for 173 types of waveform data in the test and measurement industries. The waveform rendering module provides high-performance curve rendering on the browser side, enabling smooth display and scaling of more than 10,000 curves on the browser side. Compared with traditional client-side and browser-side tools, this technology provides significant performance advantages. In the waveform data processing module, users can choose from a variety of waveform processing methods (such as high-pass filters, low-pass filters, etc.), support the superposition of processing methods, and allow users to switch historical processing processes for data comparison and find the optimal solution. Collaboration on waveform analysis charts, drawing graphics and adding text annotations on spectrum analysis charts, supports messages and discussions between team members. Provides a variety of analysis methods such as FFT, THD+N Radio, RMS Level, CPB, etc. to facilitate multi-angle data analysis.
[0103] The browser-based waveform processing tool, the Audio Editor applet, provides professional audio editing capabilities, including time-domain and time-spectrum rendering, as well as filtering, equalization, and loudness normalization. It also supports automatic generation of standard sounds and comparison with original data to meet specific sound processing needs.
[0104] In a specific embodiment, the original Waveform data is imported into the platform, and the data conversion module is called for conversion. The data conversion module will call the corresponding conversion method to convert the waveform data into a two-dimensional array based on the user's selection or automatic identification of the suffix name; the front end opens the Waveform View applet, and uses the Uplot component of the waveform rendering module to render the two-dimensional array; the waveform data processing module can perform high-pass filtering and other algorithm processing on the two-dimensional array to generate the processed two-dimensional array for rendering; the Waveform View applet saves the original data and user operation records to the platform's general file MDF, and then saves the MDF file to the data storage module.
[0105] Further, refer to Figure 1 、 Figures 4 to 6 , the step S100 includes:
[0106] S110, the data conversion module reads the format of the original data file and identifies the type of the original data file based on automatic recognition or user selection;
[0107] S120, matching a corresponding interpreter according to the type of the original data file;
[0108] S130 , calling an interpreter to interpret the data in the original data file to obtain interpreted data, wherein the interpreted data at least includes waveform data of a two-dimensional array, a sampling rate, a time length, and deviation correction data.
[0109] Specifically, when data is transferred to the Magic Number Cloud platform and opened, it automatically identifies the extension and provides the user with a recommended data conversion method. After selecting a conversion method, submit it to the backend for conversion. The data conversion module is divided into general and specialized data conversion modules, depending on the selected type. It supports waveform data from 173 different test and measurement industries.
[0110] In a specific embodiment, in step S110, referring to Figure 4 and Figure 5 The user uploads the original file "Waveform File 1.wav" and double-clicks it to open it. The system automatically recognizes the file extension as .wav and confirms that it is an audio file. The system recommends using the waveform preview tool to open it.
[0111] In the step S120, refer to Figure 6 and Figure 7 , according to the file type (.wav), select the appropriate Audio interpreter to specifically process .wav format files.
[0112] In the step S130, specifically:
[0113] 1) Reference Figure 7, two-dimensional array data read from the audio file;
[0114] 2) Sampling points: Mark them in sequence according to the sampling rate to form the SampleIndex column;
[0115] 3) Amplitude value: represents the audio signal strength at each sampling point, forming a Channel column;
[0116] SampleIndex Channel_1 Channel_2 Channel_3 Channel_4 0 81920 2592771 -44029 -44029 1 -876544 2580483 -1487869 -1487869 2 -475136 708611 -1629181 -1629184 3 1400835 -802816 1918976 1918976 4 2404355 -999424 3684352 3684355 5 -954365 -397312 182272 182275 6 …… …… …… ……
[0117] 4) Additional Information:
[0118] Sampling rate: 44100 Hz;
[0119] Total duration: 4.14 seconds;
[0120] Bias correction data: 0;
[0121] Zoom factor: 1.
[0122] In another specific embodiment, if interpreting the csv file, the following steps are included:
[0123] 1) Read the CSV file and read the first 100 rows of data;
[0124] 2) Find the first row containing text information (header) from the first 100 rows of data;
[0125] 3) From the header row found in step 2, use fuzzy recognition to find the time column, channel column, coefficient, deviation, and unit;
[0126] 4) Read all the data starting from the second row of the header row, and finally form a two-dimensional data;
[0127] 5) Calculate the sampling rate and time length of the waveform data based on the time column data, and correct the data based on the channel coefficient and deviation;
[0128] 6) Convert the data from the previous step into the platform's unified waveform format.
[0129] Further, refer to Figure 1 and Figure 8 , the step S200 includes:
[0130] S210, obtaining the pixel size of the area displayed on the browser front end and the range of the waveform display;
[0131] Specifically, the operation process is:
[0132] 1) The browser front-end calls the interface to obtain the size of the current display area (pixel width and height).
[0133] 2) Determine the display range of the waveform:
[0134] X-axis: corresponding audio time range: 0 - 4.14 seconds;
[0135] Y-axis: corresponds to the amplitude range (e.g. -32768 to 32767);
[0136] Display area: 1107*652 pixels;
[0137] Waveform range: Time 0-4.14 seconds, Amplitude -1.0 to 1.0 (normalized).
[0138] S220, resample the waveform data of the two-dimensional array to obtain a time period entry value and a time period exit value corresponding to each pixel of the x-axis in the browser front-end display area;
[0139] Specifically,
[0140] X-axis: Calculate the time interval corresponding to each pixel and average the amplitude values of these time periods from the original data;
[0141] Y-axis: Normalize the amplitude range and map the actual amplitude to pixel coordinates;
[0142] Original data: sampling rate 44100 Hz, total length 4.14 seconds, number of samples 182574;
[0143] Resampling: Each pixel corresponds to approximately 165 sampling values.
[0144] S230, calculating the y-axis position corresponding to each pixel point on the x-axis in the display area of the browser front end based on the display y-axis range set by the browser front end;
[0145] Specifically, for the resampled data, the specific position of each X pixel on the Y axis is calculated, and an X, Y pixel coordinate pair is generated for drawing the path.
[0146] S240: Create a Path object to be rendered, pass the Path object into the Canvas drawing component, and display it on the front end of the browser.
[0147] Specifically, after the 2D array conversion is complete, the waveform rendering module is called for rendering. Using the Uplot graphics rendering component and the Canvas drawing component, over 10,000 curves can be rendered on the browser side, with smooth display and zooming. This offers significant performance advantages over similar tools on traditional clients and browsers.
[0148] Further, refer to Figure 1 and Figure 8In step S300,
[0149] The preset multiple waveform data processing methods include at least high-pass filtering, low-pass filtering, band-pass filtering and Moving smoothing.
[0150] Further, refer to Figure 1 and Figure 8 If high-pass filtering is selected, step S300 includes:
[0151] S310, determining the cutoff frequency Fc;
[0152] S311, determining the type and parameters of a filter, where the filter types include a finite impulse response filter FIR and an infinite impulse response filter IIR;
[0153] S312, performing a Fourier transform operation on the discrete two-dimensional array waveform data signal to convert the two-dimensional array waveform data signal from the time domain to the frequency domain to obtain a frequency domain signal;
[0154] S313. In the frequency domain, use a high-pass filter to filter the frequency domain signal to retain frequency components higher than the cutoff frequency Fc;
[0155] S314, performing inverse Fourier transform on the filtered frequency domain signal to obtain a filtered time domain signal;
[0156] Specifically, refer to Figure 9 In steps S310 to S314, data from 2.0 seconds to 2.4 seconds are selected, high-pass filtering is selected, the cutoff frequency FC=1000 is determined, and an infinite impulse response filter IIR is selected. The filtering effect is presented as the operation progresses, effectively eliminating low-frequency noise (such as wind noise and power supply noise).
[0157] If low-pass filtering is selected, step S300 includes:
[0158] S320, determining the cutoff frequency Fc;
[0159] S321, determining the type and parameters of a filter, where the filter types include a finite impulse response filter FIR and an infinite impulse response filter IIR;
[0160] S322, performing a Fourier transform operation on the discrete two-dimensional array waveform data signal to convert the two-dimensional array waveform data signal from the time domain to the frequency domain to obtain a frequency domain signal;
[0161] S323. In the frequency domain, use a low-pass filter to filter the frequency domain signal to retain frequency components below the cutoff frequency Fc;
[0162] S324, performing an inverse Fourier transform on the filtered frequency domain signal to obtain a filtered time domain signal;
[0163] Specifically, refer to Figure 10 In the steps S320 to S324, data from 2.0 seconds to 2.4 seconds are selected, low-pass filtering is selected, the cutoff frequency FC=1000 is determined, and an infinite impulse response filter IIR is selected. The filtering effect is presented as the operation progresses, effectively smoothing the audio signal.
[0164] If bandpass filtering is selected, step S300 includes:
[0165] S330, determining the center frequency Fc and the bandwidth BW;
[0166] S331, determining the type and parameters of a filter, where the filter types include Butterworth filter and Chebyshev filter;
[0167] S332, calculating the filter order n based on the stopband attenuation AdB, the passband ripple Ap, the upper cutoff frequency f1 and the lower cutoff frequency f2;
[0168] S333, according to the selected filter type and order n, the filter coefficients are calculated through a lookup table, and finally the filter transfer function f is realized;
[0169] S334, filtering the discrete two-dimensional array waveform data signal according to the filter transfer function f;
[0170] Specifically, refer to Figure 11 In steps S330 to S334, data from 1.6 seconds to 2.0 seconds is selected, bandpass filtering is selected, the upper cutoff frequency F1 = 6400, the lower cutoff frequency F2 = 1000, an infinite impulse response filter (IIR) is selected, and the filter type is Butterworth filter. The filtering effect is presented as the operation progresses, effectively extracting signals in a specific frequency band (such as 1000-6400 Hz in audio).
[0171] If Moving smoothing is selected, step S300 includes:
[0172] S340, determining the moving window size n;
[0173] S341, based on the simple average SAM (Simple Average Measure), implement the filter function f,
[0174] Among them, SAM=(x1+x2+x3 … + xn) / n,
[0175] Where x1, x2, x3, …, xn is a set of audio data sample values, n is the number of samples, and each value in the sample is added up and divided by the total number of samples to obtain an average value for data smoothing;
[0176] S342. Use the filter function f to traverse the waveform data signal of the discrete two-dimensional array to obtain a filtered signal.
[0177] Specifically, in step S300, after the two-dimensional array conversion is complete, users can choose to use the waveform data processing module for waveform processing. This module supports various processing methods, including high-pass filtering, low-pass filtering, band-pass filtering, and moving smoothing. The processed waveform is displayed on the front-end, and all processing steps (processing time period, processing parameters, processing results, and processing end time) are recorded. Different processing methods can be superimposed. Users can switch between historical processing steps for data comparison and find the optimal processing solution.
[0178] Specifically, refer to Figure 12 In step S340 to step S342, data from 2.8 seconds to 3.4 seconds are selected, Moving smoothing is selected, the window size is set to 5 using the average calculation method, and the filtering effect is presented with the operation, effectively eliminating short-term noise and optimizing the smoothness of the waveform.
[0179] In the step S400, refer to Figure 1 and Figure 13 The waveform analysis includes at least a fast Fourier transform (FFT) analysis method, a THD+N Radio analysis method, an RMS Level analysis method, and a CPB analysis method.
[0180] If the Fast Fourier Transform (FFT) analysis method is selected, step S400 includes: segmenting the input two-dimensional array waveform data into an even index sequence and an odd index sequence, and then performing DFT calculations on the even index sequence and the odd index sequence respectively; recursively performing FFT calculations on the even index sequence and the odd index sequence obtained through the DFT calculation; and combining the results of the even index sequence and the odd index sequence obtained through the Fast Fourier Transform (FFT) calculation using a butterfly operation as a rotation factor.
[0181] Specifically, refer to Figure 13 , expand the sequence steps in the interface, click FFT and zoom in, the program automatically executes steps S410-S412, and renders the obtained frequency-amplitude data in the Canvas component to display the main frequency components of the audio signal and detect whether there is noise or distortion at a specific frequency.
[0182] The specific analysis results are
[0183] •The spectrum shows that the main energy of the audio is concentrated between 200Hz and 1kHz.
[0184] •It is possible to detect weak noise in high frequency components.
[0185] If the THD+N Radio analysis method is selected, step S400 includes: extracting the fundamental signal portion of the waveform data of the two-dimensional array through a bandpass filter; removing the fundamental signal portion from the waveform data of the two-dimensional array and calculating the residual signal portion, wherein the residual signal portion includes harmonic distortion and noise; performing a fast Fourier transform (FFT) calculation on the residual signal portion to obtain frequency domain data of the residual signal portion, finding and marking all harmonic components and noise in the frequency domain data of the residual signal portion; calculating the amplitudes V1, V2, V3, ..., and Vn of all harmonic distortion components and the total amplitude Vnoise of the noise based on the frequency domain data of the residual signal portion; and calculating the THD+N value, wherein,
[0186] ,
[0187] Specifically, refer to Figure 14 In the interface, click THD+N Radio in the sequence step and zoom in. The program automatically executes steps S420-S424 and renders the obtained frequency-total harmonic distortion value data in the Canvas component to display the distortion and noise ratio of the provided signal of the audio signal.
[0188] The specific analysis results are
[0189] • Fundamental wave amplitude: 1.2V;
[0190] • Harmonic components: 0.1V, 0.05V;
[0191] • Noise amplitude: 0.01V;
[0192] • Result: THD+N =8.7%.
[0193] If the RMS Level analysis method is selected, the step S400 includes: sampling the waveform data of the two-dimensional array; calculating the RMS of the waveform data of the two-dimensional array, wherein,
[0194] ,
[0195] Where x[n] represents the nth sample value in the data sequence, N represents the total number of samples in the data sequence, and the waveform data RMS is used to calculate the RMS level of the audio signal, effectively reflecting the average energy level of the signal and is usually used to quantify the intensity of the audio signal. Based on the RMS and the reference voltage, the RMS is calculated, where
[0196] ,
[0197] Where Vref is the reference voltage, which is used to define the benchmark of the signal level. The reference voltage is usually a known standard value. In the audio or electroacoustic fields, the reference voltage is usually 1 V.
[0198] The constant 20 is used to convert the RMS ratio to decibels (dB) because this is the dB conversion formula for voltage (or sound pressure) measurements. This formula converts the RMS value to dB to facilitate the evaluation of the signal strength relative to a reference voltage.
[0199] Specifically, refer to Figure 15 , click RMS Level in the sequence step in the interface and zoom in. The program automatically executes steps S430-S432 and renders the RMS value data of each signal in the Canvas component, which is used to measure the strength of the audio signal and audio balance or loudness analysis.
[0200] The specific analysis results are
[0201] •Channel1=0.0017dB;
[0202] •Channel2=0.0014dB;
[0203] •Channel3=0.0018dB;
[0204] •Channel4=0.0018dB.
[0205] If the CPB analysis method is selected, step S400 includes: using a fast Fourier transform (FFT) to convert the waveform data of the two-dimensional array in the time domain into frequency domain data; using the Bark frequency scale, converting the frequency domain data representation to Bark frequency to align with the auditory perception model of the human ear; dividing the frequency domain data into 24 frequency bands of non-uniform width according to the Bark frequency scale, each frequency band corresponding to a critical frequency band of the human ear, with the low frequency band being narrower and the high frequency band being wider; and calculating the total energy of all frequency components within each critical frequency band.
[0206] Specifically, refer to Figure 16, in the sequence step of the interface, click CPB and zoom in, the program automatically executes steps S440-S433, and renders the Bark frequency band energy graph of each signal in the Canvas component to test whether the audio signal conforms to the auditory perception model.
[0207] Specifically, in step S400, after the two-dimensional array conversion is complete, users can use the spectrum analysis module to perform calculations on the data using four analysis methods: FFT, THD+N Radio, RMS Level, and CPB, and display the corresponding charts. Each analysis method can be individually adjusted to analyze the data from different perspectives. After the analysis is completed, graphics and text can be drawn on the chart. Comments can be left and discussions can be held. Collaborative analysis can be achieved using graphics, text, and discussion areas on the waveform analysis chart.
[0208] Further, refer to Figure 1 In step S500, the backend data storage module stores the data including:
[0209] Source file data and file index data, the source file data is stored in the OSS file storage database, and the file index data is stored in the project database.
[0210] Specifically, after data conversion is complete, users can save the waveform data and operation process together into the Magic Number Cloud general data MDF, and store the MDF file in the back-end data storage module. The storage is divided into source files and file index data. The source file is stored in the OSS file storage database, and the file index data is stored in the Magic Number Cloud project database. The two are linked, which can improve file transfer speed and reduce back-end service operating costs. Users can access the saved MDF again through Magic Number Cloud or download the MDF file to save and use locally.
[0211] Among them, reference Figure 3 The MDF file is a safe and controllable file format for multiple file combinations. It uses zip to compress multiple files into one file and defines the file extension as mdf. The above multiple files are composed of three types of files, namely data files, description files, and main files.
[0212] 1) A data file is one or more data files obtained by collecting or exporting data from a test device. Each data file is named differently and assigned a different string as a unique identifier. The identifier uniquely identifies a data file in the description file.
[0213] 2) The description file needs to have a customized file name and should not be repeated with other files. Based on the predefined application data structure, it should record the relationship between each data file, the method of parsing each data file, and the status of the MDF application.
[0214] 3) The main file is named "app". According to the predefined main file data structure, it records the application type of the MDF file and the name, type, and encryption information of the description file, as well as the name, type, identifier, and encryption information of all data files.
[0215] The following details the process of generating a waveform viewing MDF file:
[0216] 1) Three waveform data files are collected, namely A.wav, B.wav, and C.wav, and their identifiers are assigned as A, B, and C respectively;
[0217] 2) Create a new description file named Desc, and write the parsing methods and relationships of the three files A, B, and C into the Desc file according to the data structure predefined by the application;
[0218] 3) Use a symmetric encryption algorithm and a custom key to encrypt the above four files;
[0219] 4) Write name=A.wav id=A type=csv crypt=aes256 passwd=key to the data file information section of the app file; write name=B.wav id=B type=csv crypt=aes256 passwd=key to the data file information section of the app file; write name=C.wav id=C type=csv crypt=aes256 passwd=key to the data file information section of the app file;
[0220] 5) Write name=Desc type=json crypt=aes256 passwd=key into the description file information section of the app file;
[0221] 6) Write the application type type=TYPE_DSP into the application type information segment of the app file;
[0222] 7) Use the public key issued by the system to asymmetrically encrypt the app file;
[0223] 8) Compress all the above files using zip and set the extension of the compressed file to mdf;
[0224] In addition, for other aspects of the MDF file, please refer to the description in "CN116776834A Standardized data file generation method and storage medium based on measurement and control applications".
[0225] Further, refer to Figure 2The present invention further provides an audio file processing device for executing the audio file processing method. The audio file processing device at least comprises:
[0226] Raw data module;
[0227] A back-end module, comprising a data conversion module and a data storage module, wherein the data conversion module is connected to the original data module;
[0228] The front-end module includes a waveform rendering module, a waveform data processing module and a spectrum analysis module. The waveform rendering module is connected to the data conversion module, and the waveform processing module and the spectrum analysis module are respectively connected to the data storage module.
[0229] Specifically, the original data module is the Waveform original data; the data conversion module includes a general waveform data conversion module and a special waveform data conversion module; the data storage module includes a data index information database and an OSS file storage database.
[0230] The waveform rendering module and the waveform data processing module constitute the main components of the Waveform View applet. Among them, the waveform rendering module includes the time domain graph module and the spectrum analysis module, and the waveform data processing module includes the processing tools and the processing process controller.
[0231] The waveform rendering module and the spectrum analysis module constitute the main components of the Audio Editor applet.
[0232] Further, refer to Figure 1 The present invention also provides a computer-readable storage medium having program instructions stored thereon, and the program instructions implement the audio file processing method when executed by a processor.
[0233] The above description is merely a preferred embodiment of the present invention. The present invention is not limited to the aforementioned embodiments. As long as the technical effects of the present invention are achieved by the same means, any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included within the scope of protection of the present disclosure. Within the scope of protection of the present invention, its technical solutions and / or implementation methods may be modified and varied in various ways.
Claims
1. A method for processing an audio file, applied to an audio file processing device, the audio file processing device comprising at least: Raw data module; A back-end module, comprising a data conversion module and a data storage module, wherein the data conversion module is connected to the original data module; A front-end module, comprising a waveform rendering module, a waveform data processing module, and a spectrum analysis module, wherein the waveform rendering module is connected to the data conversion module, and the waveform data processing module and the spectrum analysis module are respectively connected to the data storage module. The method for processing an audio file comprises the following steps: S100, the data conversion module converts the original data file into waveform data of a two-dimensional array; S200, the waveform rendering module renders the waveform data of the two-dimensional array on the browser front end based on the Uplot graphics rendering component and the Canvas drawing component; S300, based on a plurality of preset waveform data processing methods, the waveform data processing module processes the waveform data of the two-dimensional array, displays the processed waveform on the front end of the browser and records the processing process; S400, based on the spectrum analysis module, performing waveform analysis on the waveform data of the two-dimensional array and displaying the corresponding chart on the front end of the browser, wherein the waveform analysis includes at least a fast Fourier transform (FFT) analysis method, a THD+N Radio analysis method, an RMS Level analysis method, and a CPB analysis method; For the Fast Fourier Transform (FFT) analysis method, the waveform data of the input two-dimensional array is divided into an even index sequence and an odd index sequence, and then the DFT calculation is performed on the even index sequence and the odd index sequence respectively; the FFT calculation is recursively performed on the even index sequence and the odd index sequence after the DFT calculation; the results of the even index sequence and the odd index sequence after the Fast Fourier Transform (FFT) calculation are combined using a butterfly operation as a rotation factor; For the THD+N Radio analysis method, a bandpass filter is used to extract the fundamental signal portion of the waveform data of the two-dimensional array; the fundamental signal portion is removed from the waveform data of the two-dimensional array to calculate the residual signal portion, which contains harmonic distortion and noise; a fast Fourier transform (FFT) calculation is performed on the residual signal portion to obtain frequency domain data of the residual signal portion, and all harmonic components and noise in the frequency band in the frequency domain data of the residual signal portion are found and marked; the amplitudes V1, V2, V3, ... and V of all harmonic distortion components are calculated using the frequency domain data of the residual signal portion. n , and the total amplitude of the noise V noise ; Calculate the THD+N value, where For the RMS Level analysis method, the waveform data of the two-dimensional array is sampled; the RMS of the waveform data of the two-dimensional array is calculated, where Where x[n] represents the nth sample value in the data sequence, and N represents the total number of samples in the data sequence. Calculate RMS (db) based on RMS and reference voltage, where Among them, V ref is the reference voltage used to define the base of the signal level, and the constant 20 is used to convert the RMS ratio into decibel dB units; For the CPB analysis method, the fast Fourier transform (FFT) is used to convert the waveform data of the two-dimensional array in the time domain into frequency domain data. The frequency domain data is converted to the Bark frequency representation through the Bark frequency scale to align with the auditory perception model of the human ear. According to the Bark frequency scale, the frequency domain data is divided into 24 frequency bands of non-uniform width, each of which corresponds to a critical frequency band of the human ear, with the low frequency band being narrower and the high frequency band being wider. The total energy of all frequency components within each critical frequency band is calculated. S500, saving the waveform data and the operation process as MDF file data, and storing it in the back-end data storage module; Among them, the process of generating an MDF file is as follows: collecting multiple waveform data files and assigning identifiers to the multiple waveform data files respectively; creating a description file, writing the parsing methods and mutual relationships of the multiple waveform data files into the description file according to a predefined data structure; encrypting the multiple waveform data files and the description file through a symmetric encryption algorithm; creating a master file, writing the file names, ID numbers, types, encryption configuration information and keys of the multiple waveform data files and the description file into the data file information segment of the master file respectively; writing the application type into the application type information segment of the master file; asymmetrically encrypting the master file through a public key; and compressing the multiple waveform data files, the description file and the master file through zip to obtain a compressed file.
2. The audio file processing method according to claim 1, characterized in that: The step S100 includes: S110, the data conversion module reads the format of the original data file and identifies the type of the original data file based on automatic recognition or user selection; S120, matching a corresponding interpreter according to the type of the original data file; S130 , calling an interpreter to interpret the data in the original data file to obtain interpreted data, wherein the interpreted data at least includes waveform data of a two-dimensional array, a sampling rate, a time length, and deviation correction data.
3. The audio file processing method according to claim 1, wherein: The step S200 includes: S210, obtaining the pixel size of the area displayed on the browser front end and the range of the waveform display; S220, resample the waveform data of the two-dimensional array to obtain a time period entry value and a time period exit value corresponding to each pixel of the x-axis in the browser front-end display area; S230, calculating the y-axis position corresponding to each pixel point on the x-axis in the display area of the browser front end based on the display y-axis range set by the browser front end; S240: Create a Path object to be rendered, pass the Path object into the Canvas drawing component, and display it on the front end of the browser.
4. The audio file processing method according to claim 1, wherein: In the step S300, The preset multiple waveform data processing methods include at least high-pass filtering, low-pass filtering, band-pass filtering and Moving smoothing.
5. The audio file processing method according to claim 4, characterized in that: If high-pass filtering is selected, step S300 includes: S310, determining the cutoff frequency Fc; S311, determining the type and parameters of a filter, where the filter types include a finite impulse response filter FIR and an infinite impulse response filter IIR; S312, performing a Fourier transform operation on the discrete two-dimensional array waveform data signal to convert the two-dimensional array waveform data signal from the time domain to the frequency domain to obtain a frequency domain signal; S313. In the frequency domain, use a high-pass filter to filter the frequency domain signal to retain frequency components higher than the cutoff frequency Fc; S314, performing an inverse Fourier transform on the filtered frequency domain signal to obtain a filtered time domain signal; If low-pass filtering is selected, step S300 includes: S320, determining the cutoff frequency Fc; S321, determining the type and parameters of a filter, where the filter types include a finite impulse response filter FIR and an infinite impulse response filter IIR; S322, performing a Fourier transform operation on the discrete two-dimensional array waveform data signal to convert the two-dimensional array waveform data signal from the time domain to the frequency domain to obtain a frequency domain signal; S323. In the frequency domain, use a low-pass filter to filter the frequency domain signal to retain frequency components below the cutoff frequency Fc; S324, performing an inverse Fourier transform on the filtered frequency domain signal to obtain a filtered time domain signal; If bandpass filtering is selected, step S300 includes: S330, determining the center frequency Fc and the bandwidth BW; S331, determining the type and parameters of a filter, where the filter types include Butterworth filter and Chebyshev filter; S332, calculating the filter order n based on the stopband attenuation AdB, the passband ripple Ap, the upper cutoff frequency f1 and the lower cutoff frequency f2; S333, according to the selected filter type and order n, the filter coefficients are calculated through a lookup table, and finally the filter transfer function f is realized; S334, filtering the discrete two-dimensional array waveform data signal according to the filter transfer function f; If Moving smoothing is selected, step S300 includes: S340, determining the moving window size n; S341, based on the simple average SAM, realize the filter function f, Where, SAM=(x1+x2+x3…+xn) / n, Where x1, x2, x3, …, xn is a set of audio data sample values, and n is the number of samples; S342. Use the filter function f to traverse the waveform data signal of the discrete two-dimensional array to obtain a filtered signal.
6. The audio file processing method according to claim 1, characterized in that: In step S500, the backend data storage module stores the data including: Source file data and file index data, the source file data is stored in the OSS file storage database, and the file index data is stored in the project database.
7. An audio file processing device, configured to execute the audio file processing method according to any one of claims 1 to 6, wherein the audio file processing device comprises at least: Raw data module; A back-end module, comprising a data conversion module and a data storage module, wherein the data conversion module is connected to the original data module; The front-end module includes a waveform rendering module, a waveform data processing module and a spectrum analysis module. The waveform rendering module is connected to the data conversion module, and the waveform data processing module and the spectrum analysis module are respectively connected to the data storage module.
8. A computer-readable storage medium having program instructions stored thereon, wherein when the program instructions are executed by a processor, the audio file processing method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Standardized data file generation method based on measurement and control application and storage medium
CN116776834A
Voice frequency feature extraction method and device
CN108766461A
Audio filtering method, audio filtering device and wearable device
CN110021305A