An audio classification method, apparatus, device, and storage medium
By performing frame-by-frame processing and energy value comparison on audio, the problem of large data processing volume in existing technologies is solved, achieving efficient audio classification, reducing the need for encoding and decoding processing, and improving classification accuracy.
Patent Information
- Application Number
- CN202110550191.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-12-31
- Filing Date
- 2021-05-20
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2041-05-20
AI Technical Summary
Existing audio classification schemes require different encoding and decoding methods to process the audio to be classified, resulting in a large amount of data processing.
By segmenting the audio into frames, calculating the energy value of each superframe, and comparing the energy value of each subframe with the energy value of the superframe according to the set comparison conditions and energy distribution, the classification result of the superframe is determined by comparing the quantization result with the classification threshold.
This reduces the amount of data processing, improves the accuracy and efficiency of audio classification, and reduces the need for audio encoding and decoding.
Smart Images

Figure CN114694642B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of audio technology, and in particular to an audio classification method, apparatus, device, and storage medium. Background Technology
[0002] In some scenarios, it is necessary to classify audio. For example, in audio encoding, audio signals can be divided into speech signals (SPEECH) and non-speech signals (AUDIO), and different encoding methods can be used for SPEECH signals and AUDIO signals respectively.
[0003] Currently, some related audio classification schemes typically involve: encoding and decoding the audio to be classified using encoding methods for SPEECH signals and corresponding decoding methods for AUDIO signals, respectively; then comparing the audio quality obtained by encoding and decoding using these two methods. If the audio quality obtained by encoding and decoding using the SPEECH signal encoding and corresponding decoding methods is higher, then the audio is determined to be a SPEECH signal; if the audio quality obtained by encoding and decoding using the AUDIO signal encoding and corresponding decoding methods is higher, then the audio is determined to be an AUDIO signal.
[0004] However, this audio classification scheme requires different encoding and decoding methods to process the audio to be classified, resulting in a large amount of data processing. Summary of the Invention
[0005] The purpose of this invention is to provide an audio classification method, apparatus, device, and storage medium to reduce the amount of data processing.
[0006] To achieve the above objectives, embodiments of the present invention provide an audio classification method, including:
[0007] Get the audio to be categorized;
[0008] The audio to be classified is subjected to frame segmentation to obtain multiple superframes. Each superframe includes multiple audio frames, and each audio frame includes multiple subframes.
[0009] For each superframe, calculate the energy value of the superframe; for each subframe in the superframe, compare the energy value of the subframe with the energy value of the superframe according to the set comparison conditions to obtain the comparison result corresponding to the subframe; quantize the comparison result corresponding to each subframe in the superframe to obtain the quantization result; compare the quantization result with the set classification threshold, and determine the classification result of the superframe based on the comparison result.
[0010] Optionally, the process of setting the comparison conditions includes:
[0011] Obtain sample audio from multiple known categories;
[0012] The energy distribution of sample audio for each category is statistically analyzed, including the proportion of subframes located in each energy value range;
[0013] The comparison conditions are set by comparing the energy distribution of sample audio in each category.
[0014] Optionally, the step of separately calculating the energy distribution of sample audio for each category includes:
[0015] Using the same framing method, the sample audio of each category is processed into frames. Each category of sample audio includes multiple superframes, each superframe includes multiple audio frames, and each audio frame includes multiple subframes.
[0016] For each category of sample audio, calculate the maximum energy value and average energy value of each superframe in the sample audio of that category; set each energy value interval based on the maximum energy value and the average energy value; and count the proportion of subframes in each energy value interval in the sample audio of that category.
[0017] Optionally, the step of setting the comparison conditions by comparing the energy distribution of sample audio in each category includes:
[0018] By comparing the energy distribution of sample audio in each category, the energy value that meets the preset difference condition for the subframe ratio difference is determined as the target energy value;
[0019] Determine the position of the target energy value within the energy value range, and use this position as the target location;
[0020] The comparison condition is set as follows: the energy value of the subframe is compared with the energy value of the superframe at the target position in the energy value range.
[0021] Optionally, setting each energy value range based on the maximum energy value and the average energy value includes:
[0022] With an interval of 0.05 times the average energy value, set the energy value range between 0 and twice the average energy value; with an interval of 0.05 times the difference between the maximum energy value and the average energy value, set the energy value range between twice the average energy value and the maximum energy value.
[0023] The energy value of the superframe at the target position within the energy value range is 0.1 times the average energy value of the superframe;
[0024] The step of quantizing the comparison results corresponding to each subframe in the superframe to obtain the quantization result includes:
[0025] The proportion of subframes in the superframe whose energy value is less than 0.1 times the average energy value of the superframe is counted and used as the proportion of the first subframe.
[0026] The step of comparing the quantization result with a set classification threshold and determining the classification result of the superframe based on the comparison result includes:
[0027] Determine whether the proportion of the first subframe is less than the first classification threshold. If it is less, the superframe is determined to be a non-speech signal; if it is not less, the superframe is determined to be a speech signal.
[0028] Optionally, the target location may also include 0.5 times the average energy value;
[0029] If the proportion of the first subframe is determined to be not less than the first classification threshold, the method further includes:
[0030] The proportion of subframes in the superframe whose energy value is greater than 0.5 times the average energy value of the superframe is counted and used as the proportion of the second subframe;
[0031] Determine whether the proportion of the second subframe is less than the second classification threshold. If it is less, determine that the superframe is a non-speech signal; otherwise, determine that the superframe is a speech signal.
[0032] Optionally, if it is determined that the proportion of the first subframe is not less than the first classification threshold, the method further includes:
[0033] If the classification results of the previous preset number of superframes are all non-speech signals, then if the proportion of the first subframe is not less than the third classification threshold, the superframe is determined to be a speech signal, and the third classification threshold is greater than the first classification threshold.
[0034] If the proportion of the first subframe is determined to be less than the first classification threshold, the method further includes:
[0035] If the classification results of the previous preset number of superframes are all speech signals, then if the proportion of the first subframe is not less than the fourth classification threshold, the superframe is determined to be a speech signal, where the fourth classification threshold is less than the first classification threshold.
[0036] Optionally, before comparing the energy value of the subframe with the energy value of the superframe according to the set comparison conditions to obtain the comparison result corresponding to the subframe, the method further includes:
[0037] Determine whether the energy value of the subframe is less than a preset energy threshold;
[0038] If it is less than, then the superframe to which this subframe belongs is determined to be a silent frame;
[0039] If the value is not less than the set value, the step of comparing the energy value of the subframe with the energy value of the superframe according to the set comparison conditions is performed to obtain the comparison result corresponding to the subframe.
[0040] Optionally, after determining the classification result of the superframe, the method further includes:
[0041] If the previous superframe of this superframe is a silent frame, and the classification result of this superframe is different from the classification result of its next superframe, then the classification result of this superframe is modified to be the same as the classification result of its next superframe.
[0042] And / or,
[0043] If the next superframe of a superframe is a silent frame, and the classification result of the superframe is different from the classification result of its previous superframe, then the classification result of the superframe is modified to be the same as the classification result of its previous superframe.
[0044] Optionally, after determining the classification result of the superframe, the method further includes:
[0045] If the classification results of the previous and next superframes of a superframe are the same, and the classification results of the superframe are different from those of the previous and next superframes, then the classification result of the superframe is modified to be the same as those of the previous and next superframes.
[0046] To achieve the above objectives, embodiments of the present invention also provide an audio classification device, comprising:
[0047] The first acquisition module is used to acquire the audio to be classified.
[0048] The frame segmentation module is used to perform frame segmentation processing on the audio to be classified to obtain multiple superframes. Each superframe includes multiple audio frames, and each audio frame includes multiple subframes.
[0049] The calculation module is used to calculate the energy value of each superframe.
[0050] The first comparison module is used to compare the energy value of each subframe in the superframe with the energy value of the superframe according to the set comparison conditions, and obtain the comparison result corresponding to the subframe.
[0051] The quantization module is used to quantize the comparison results corresponding to each subframe in the superframe to obtain the quantization result.
[0052] The second comparison module is used to compare the quantization result with a set classification threshold, and determine the classification result of the superframe based on the comparison result.
[0053] Optionally, the device further includes:
[0054] The second acquisition module is used to acquire sample audio from multiple known categories;
[0055] The first statistical module is used to statistically analyze the energy distribution of sample audio for each category, including the proportion of subframes located in each energy value range.
[0056] The setting module is used to set the comparison conditions by comparing the energy distribution of sample audio in each category.
[0057] Optionally, the first statistics module includes:
[0058] The framing submodule is used to perform framing processing on sample audio of each category using the same framing method. Each category of sample audio includes multiple superframes, each superframe includes multiple audio frames, and each audio frame includes multiple subframes.
[0059] The calculation submodule is used to calculate the maximum energy value and average energy value of each superframe in the sample audio of each category;
[0060] A setting submodule is used to set each energy value range based on the maximum energy value and the average energy value;
[0061] The statistics submodule is used to calculate the proportion of subframes in each energy value range of the sample audio for this category.
[0062] Optionally, the setting module is specifically used for:
[0063] By comparing the energy distribution of sample audio in each category, the energy value that meets the preset difference condition for the subframe ratio difference is determined as the target energy value;
[0064] Determine the position of the target energy value within the energy value range, and use this position as the target location;
[0065] The comparison condition is set as follows: the energy value of the subframe is compared with the energy value of the superframe at the target position in the energy value range.
[0066] Optionally, the setting submodule is specifically used for:
[0067] With an interval of 0.05 times the average energy value, set the energy value range between 0 and twice the average energy value; with an interval of 0.05 times the difference between the maximum energy value and the average energy value, set the energy value range between twice the average energy value and the maximum energy value.
[0068] The energy value of the superframe at the target position within the energy value range is 0.1 times the average energy value of the superframe;
[0069] The quantization module is specifically used to: count the proportion of subframes in the superframe whose energy value is less than 0.1 times the average energy value of the superframe, and use this proportion as the first subframe proportion;
[0070] The second comparison module is specifically used to: determine whether the proportion of the first subframe is less than the first classification threshold; if it is less, then trigger the first determination module; if it is not less, then trigger the second determination module.
[0071] The first determining module is used to determine that the superframe is a non-speech signal;
[0072] The second determining module is used to determine that the superframe is a voice signal.
[0073] Optionally, the target location may also include 0.5 times the average energy value;
[0074] The device further includes:
[0075] The second statistics module is used to, when it is determined that the proportion of the first subframe is not less than the first classification threshold, count the proportion of subframes in the superframe whose energy value is greater than 0.5 times the average energy value of the superframe, and use this as the second subframe proportion.
[0076] The first determination module is used to determine whether the proportion of the second subframe is less than the second classification threshold. If it is less, the first determination module is triggered; otherwise, the second determination module is triggered.
[0077] Optionally, the device further includes:
[0078] The second determination module is used to determine whether the proportion of the first subframe is not less than a third classification threshold when the proportion of the first subframe is not less than a first classification threshold and the classification results of a preset number of superframes before the superframe are all non-speech signals. If so, the second determination module is triggered. The third classification threshold is greater than the first classification threshold.
[0079] The third judgment module is used to determine whether the proportion of the first subframe is not less than the fourth classification threshold when the proportion of the first subframe is less than the first classification threshold and the classification results of the preset number of superframes before the superframe are all speech signals. If so, the second determination module is triggered, wherein the fourth classification threshold is less than the first classification threshold.
[0080] Optionally, the device further includes:
[0081] The fourth judgment module is used to determine whether the energy value of the subframe is less than a preset energy threshold; if it is less, the third determination module is triggered; if it is not less, the first comparison module is triggered.
[0082] The third determining module is used to determine whether the superframe to which the subframe belongs is a silent frame;
[0083] Optionally, the device further includes:
[0084] The first modification module is used to modify the classification result of the superframe to be the same as the classification result of the next superframe if the previous superframe of the superframe is a silent frame and the classification result of the superframe is different from the classification result of the next superframe.
[0085] And / or,
[0086] If the next superframe of a superframe is a silent frame, and the classification result of the superframe is different from the classification result of its previous superframe, then the classification result of the superframe is modified to be the same as the classification result of its previous superframe.
[0087] Optionally, the device further includes:
[0088] The second modification module is used to modify the classification result of the superframe to be the same as the classification result of the previous superframe and the next superframe if the classification result of the superframe is the same and the classification result of the superframe is different from both the previous and the next superframe.
[0089] To achieve the above objectives, embodiments of the present invention also provide an electronic device, including a processor and a memory;
[0090] Memory, used to store computer programs;
[0091] The processor, when executing the program stored in memory, implements any of the above audio classification methods.
[0092] To achieve the above objectives, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the above-described audio classification methods.
[0093] Applying the embodiments shown in this invention, the audio to be classified is segmented into frames to obtain multiple superframes. Each superframe includes multiple audio frames, and each audio frame includes multiple subframes. For each superframe, the energy value of the superframe is calculated. For each subframe within the superframe, the energy value of the subframe is compared with the energy value of the superframe according to a set comparison condition to obtain the comparison result corresponding to the subframe. The comparison result corresponding to each subframe within the superframe is then quantized to obtain the quantization result. The quantization result is compared with a set classification threshold, and the classification result of the superframe is determined based on the comparison result. It can be seen that in this scheme, by segmenting the audio into frames and comparing energy values, the classification result of each superframe can be determined without using different encoding / decoding methods to encode and decode the audio, thus reducing the amount of data processing.
[0094] Of course, implementing any product or method of the present invention does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0095] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0096] Figure 1 This is a schematic diagram of the first flowchart of the audio classification method provided in an embodiment of the present invention;
[0097] Figure 2a This is a schematic diagram illustrating the energy distribution of three typical SPEECH signals provided in this embodiment of the invention.
[0098] Figure 2b This is a schematic diagram illustrating the energy distribution of three typical AUDIO signals provided in an embodiment of the present invention;
[0099] Figure 2c This is a schematic diagram comparing the energy distribution of a castanet-type signal and a typical SPEECH signal, provided in an embodiment of the present invention.
[0100] Figure 3a , Figure 3b , Figure 3c and Figure 3d This is a schematic diagram illustrating various scenarios for modifying the classification results of superframes, as provided in embodiments of the present invention.
[0101] Figure 4 This is a schematic diagram of a second flowchart of the audio classification method provided in an embodiment of the present invention;
[0102] Figure 5 This is a schematic diagram of the structure of an audio classification device provided in an embodiment of the present invention;
[0103] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0104] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of the present invention.
[0105] To achieve the above objectives, embodiments of the present invention provide an audio classification method, apparatus, device, and storage medium. This method and apparatus can be applied to various electronic devices, and the specific type of electronic device is not limited. The audio classification method will first be described in detail below. The steps in the following method embodiments can be executed in a logical order; the step numbers or the order in which the steps are described do not constitute a limitation on the execution order of the steps.
[0106] Figure 1 A first flowchart illustrating the audio classification method provided in this embodiment of the invention includes:
[0107] S101: Obtain the audio to be categorized.
[0108] For example, the audio to be classified obtained in S101 can be a television audio signal, a digital audio broadcast audio signal, or an audio signal under VoLTE (Voice over Long-Term Evolution, a high-speed wireless communication standard for mobile phones and data terminals), etc. This embodiment of the invention does not limit the specific type or source of the audio to be classified.
[0109] The audio to be classified can be the original audio signal, or it can be a resampled version of the original audio signal, with the resampled signal used as the audio to be classified. For example, assuming an input of 2048 sample points constitutes one audio frame, and the sampling rate of the signal is 32kHz, the length of one audio frame is 64ms. This is merely an example and does not impose any limitations on the frequency, length, or other parameters of the audio to be classified.
[0110] S102: Perform frame segmentation on the audio to be classified to obtain multiple superframes. Each superframe includes multiple audio frames, and each audio frame includes multiple subframes.
[0111] A superframe consists of multiple audio frames, and the number of audio frames included in a superframe is not limited. In an exemplary embodiment of the present invention, each superframe may include 8 audio frames, and each audio frame may include 8 subframes.
[0112] Continuing with the example above, assuming that 2048 sample points are input as an audio frame, when the sampling rate of the signal is 32kHz, the length of an audio frame is 64ms; each audio frame can be divided into 8 non-overlapping subframes, that is, each subframe includes 256 sample points and the length of each subframe is 8ms; every 8 audio frames form a superframe, and the length of each superframe is 512ms.
[0113] Alternatively, in other embodiments, 1024 sample points can be defined as one audio frame, and each frame can be divided into 16 subframes, etc., depending on the actual situation. This embodiment of the invention does not limit the framing of the audio.
[0114] S103: For each superframe, calculate the energy value of that superframe.
[0115] Continuing with the example above, suppose that a resampled frame x[n] is divided into 8 subframes, x[n] includes 2048 sample points, and each subframe includes 256 sample points. The energy value of each subframe m can be calculated using the following formula 1.
[0116]
[0117] Where k represents the sequence number of the audio frame included in the superframe, k = 0, 1, ..., 7, m represents the sequence number of the subframe included in the audio frame, n represents the sequence number of the sample point in the subframe, and E suber [k][m] represents the energy value of the m-th subframe in the k-th audio frame.
[0118] The energy value of the superframe calculated in S103 can be the average energy value of all subframes included in the superframe, or it can be the average energy value of the remaining subframes after removing a portion of the subframes in the superframe, or the median energy value of all or some subframes included in the superframe, etc. The specific forms of the superframe energy value will not be listed one by one. The energy value of the superframe only needs to reflect the energy status of the superframe.
[0119] The following example illustrates how the energy value of a superframe can be calculated using the formula 2 below: "The energy value of a superframe is the average energy value of all subframes included in the superframe."
[0120]
[0121] S104: For each subframe in the superframe, according to the set comparison conditions, compare the energy value of the subframe with the energy value of the superframe to obtain the comparison result corresponding to the subframe.
[0122] The comparison conditions set in S104 can be pre-defined to analyze and compare sample audio from multiple known categories. These comparison conditions can reflect the differences between different categories of audio to a large extent.
[0123] In an exemplary embodiment of the present invention, the process of setting the comparison conditions may include: acquiring sample audio of multiple known categories; statistically analyzing the energy distribution of sample audio of each category, wherein the energy distribution includes the proportion of subframes located in each energy value interval; and setting the comparison conditions by comparing the energy distribution of sample audio of each category.
[0124] For example, refer to Figure 2a and Figure 2b As shown, Figure 2a The image shows the energy distribution of three typical SPEECH signals. Figure 2b The image shows the energy distribution of three typical AUDIO signals. Figure 2a and Figure 2b The horizontal axis represents the energy value range, and the vertical axis represents the proportion of subframes falling within the corresponding energy value range. On the horizontal axis, 1 represents 0.05E. aver 2 represents 0.1E aver ...40 represents 2E aver ...60 represents the maximum energy value E of the superframe. max In the example above, each superframe consists of 8 audio frames, and each audio frame consists of 8 subframes. In this case, the proportion of subframes on the vertical axis can be: the number of subframes in each superframe that fall within the corresponding energy value range / 8 * 8.
[0125] In one exemplary embodiment of the present invention, generation Figure 2a and Figure 2b The energy distribution shown, or in other words, the energy distribution of sample audio for each category, can be analyzed through the following steps:
[0126] Using the same framing method, the sample audio of each category is processed into frames. Each category of sample audio includes multiple superframes, each superframe includes multiple audio frames, and each audio frame includes multiple subframes.
[0127] For each category of sample audio, calculate the maximum energy value and average energy value of each superframe in the sample audio of that category; set each energy value interval based on the maximum energy value and the average energy value; and count the proportion of subframes in each energy value interval in the sample audio of that category.
[0128] The “same framing method” mentioned in this exemplary embodiment can be the same as the framing method in S102. It is still assumed that 2048 sample points are input as an audio frame. Each audio frame is resampled into a 32kHz signal, and then each frame signal is divided into 8 subframes. That is, the resampled frame x[n] is divided into 8 subframes. x[n] includes 2048 sample points, and each subframe includes 256 sample points. The 32kHz signal after resampling of every 8 frames forms a superframe.
[0129] Maximum energy value E of superframe max The average energy value E of a superframe can be understood as the maximum energy value among all subframes included in the superframe (or some subframes can be removed). aver It can be understood as the average energy value among all subframes included in the superframe (or some subframes can be removed).
[0130] The maximum energy value E of the superframe can be calculated using the following formula 3. max :
[0131] E max =max{E suber [k][m]}k=0,1,...7m=0,1,...7
[0132] Based on the maximum energy value E max and average energy value E aver Define energy value ranges; for example, you can define them based on the maximum energy value E. max The energy value range is set to 0-E. max According to the average energy value E aver Set the interval for each energy value range.
[0133] In one scenario, the energy value range from 0 to 2 times the average energy value can be defined with an interval of 0.05 times the average energy value. Conversely, the energy value range from 2 times the average energy value to the maximum energy value can be defined with an interval of 0.05 times the difference between the maximum energy value and the average energy value. In other words, for values not exceeding 2 times E... aver The energy, at 0.05E aver The energy distribution of each interval is statistically analyzed at intervals, for intervals greater than 2 times E. aver And less than E max The energy is 0.05*(E max -2*E aver The energy distribution of each interval is statistically analyzed.
[0134] The above-described energy value ranges are merely illustrative examples. This embodiment of the invention does not limit the specific settings of these energy value ranges.
[0135] In one exemplary embodiment of the present invention, setting the comparison conditions by comparing the energy distribution of sample audio in each category may include:
[0136] By comparing the energy distribution of sample audio in each category, the energy value that satisfies the preset difference condition for the subframe ratio difference is determined as the target energy value; the position of the target energy value in the energy value interval is determined as the target position.
[0137] The comparison condition is set as follows: the energy value of the subframe is compared with the energy value of the superframe at the target position in the energy value range.
[0138] By comparison Figure 2a and Figure 2b It can be seen that on the horizontal axis 1 (0.05E) aver )~3(0.15E aver Within this energy distribution range, the SPEECH and AUDIO signals show significant differences. Assuming the horizontal axis is 2 as the target energy value, denoted as F(2), the target energy value lies at 0.1E within the energy value range. aver For ease of description, the position within the energy value range is referred to as the target position. Thus, the comparison condition in S104 can be: compare the energy value of the subframe with the 0.1E value of the superframe. aver Compare them.
[0139] S105: Quantize the comparison results corresponding to each subframe in the superframe to obtain the quantization result.
[0140] In an exemplary embodiment of the present invention, S105 may include: calculating the proportion of subframes in the superframe whose energy value is less than 0.1 times the average energy value of the superframe, and using this proportion as the first subframe proportion.
[0141] In this exemplary embodiment, if the energy value of the subframe is less than 0.1E of the superframe... aver The subframe can be marked as 1, otherwise it can be marked as 0. Then, the number of subframes marked as 1 in a superframe is counted, and the number is divided by 64 to get the proportion of the first subframe.
[0142] This embodiment is for illustrative purposes only and does not limit the marking of subframes or the quantization method. For example, energy values less than 0.1E of the superframe can also be used. aver The subframe is marked as 0, and the energy value is not less than 0.1E of the superframe. aver This subframe is marked as 1. It's possible to count the number of subframes with energy values less than 0.1E within a superframe. aver The number of subframes is used as the quantization result, or, in other words, the energy value in a superframe is not less than 0.1E. averThe number of subframes is used as the quantization result.
[0143] S106: Compare the quantization result with the set classification threshold, and determine the classification result of the superframe based on the comparison result.
[0144] Continuing with the above embodiment, the quantization result is the first subframe ratio. In this embodiment, S106 may include: determining whether the first subframe ratio is less than a first classification threshold; if it is less, then determining that the superframe is a non-speech signal; if it is not less, then determining that the superframe is a speech signal.
[0145] Extensive experimental research has shown that the first classification threshold can be set to 0.005. Alternatively, other first classification thresholds can be set according to actual conditions. This embodiment of the invention does not limit the specific value of the first classification threshold.
[0146] As can be seen, by analyzing and comparing the energy distribution of SPEECH and AUDIO signals using the embodiments of the present invention, comparison conditions that can distinguish between SPEECH and AUDIO signals are set. Based on these comparison conditions and the set classification threshold, it is determined whether the audio to be classified is a SPEECH signal or an AUDIO signal, without the need to use different encoding and decoding methods to encode and decode the audio, thus reducing the amount of data processing.
[0147] The energy distribution of most SPEECH conforms to Figure 2a As shown, most AUDIO signals conform to Figure 2b As shown, there are some special signals, such as castanets, whose energy distribution is as follows: Figure 2c As shown, the energy distribution of these special signals is similar to that of the SPEECH signal (similar in the larger part of the horizontal axis), but they actually belong to the AUDIO signal.
[0148] Depend on Figure 2c It can be seen that these special signals occupy a large proportion in the small portion of the horizontal axis; for example, the curve rises rapidly when the horizontal axis is less than 10, and then stabilizes and tends to become a straight line. Based on this, F(10) can be chosen as the energy value range to distinguish these special signals from the SPEECH signal. That is to say, the target position can also include F(10), which is 0.5 times the average energy value E. aver .
[0149] In the above embodiment, the target position is F(2), which is 0.1E. aver In another exemplary embodiment of the present invention, the target location within the energy value range also includes F(10), which is 0.5 times the average energy value E. averIn this exemplary embodiment, if it is determined that the proportion of the first subframe is not less than the first classification threshold, the proportion of subframes in the superframe whose energy value is greater than 0.5 times the average energy value of the superframe can be counted as the second subframe proportion; it is then determined whether the second subframe proportion is less than the second classification threshold. If it is less, the superframe is determined to be a non-speech signal; otherwise, the superframe is determined to be a speech signal.
[0150] Continuing with the above embodiment, if the superframe is determined to be a SPEECH frame, the number of subframes in the superframe with energy greater than F(10) can be counted and divided by 64 for normalization. Alternatively, for ease of calculation, the number of subframes in the superframe with energy greater than 1-F(10) can be counted and divided by 64 for normalization. In this case, the second classification threshold can be set to 0.05. If the proportion of the second subframe obtained after normalization is less than 0.05, the superframe is determined to be an AUDIO frame. Alternatively, other second classification thresholds can be set according to the actual situation. This embodiment of the invention does not limit the specific value of the second classification threshold.
[0151] As can be seen, by applying this exemplary embodiment, the interference of special signals, such as castanets, on signal classification can be reduced, thereby further improving the accuracy of the classification results.
[0152] Continuing with the above embodiment, the quantization result is the proportion of the first subframe. In this embodiment, if it is determined that the proportion of the first subframe is not less than the first classification threshold, the method further includes:
[0153] If the classification results of the previous preset number of superframes are all non-speech signals, then if the proportion of the first subframe is not less than the third classification threshold, the superframe is determined to be a speech signal, and the third classification threshold is greater than the first classification threshold.
[0154] If the proportion of the first subframe is determined to be less than the first classification threshold, the method further includes: if the classification results of the previous preset number of superframes are all speech signals, then if the proportion of the first subframe is determined to be not less than the fourth classification threshold, the superframe is determined to be a speech signal, wherein the fourth classification threshold is less than the first classification threshold.
[0155] For example, the number of preceding SPEECH and AUDIO superframes can be counted separately. If the number of preceding AUDIO superframes is greater than X (a preset number), meaning the superframe is more inclined towards AUDIO, then the superframe is only classified as a SPEECH superframe if the proportion of the first subframe is not less than 0.05 (the third classification threshold, which is greater than the first classification threshold of 0.005). If the number of preceding SPEECH superframes is greater than Z, meaning the superframe is more inclined towards SPEECH, then the superframe is only classified as a SPEECH superframe if the low energy ratio is greater than 0.0025 (the fourth classification threshold, which is less than the third classification threshold). The preset number Z can be 3, 4, 5, etc., and the specific value is not limited. The thresholds here are only illustrative examples, and the embodiments of this invention do not limit the specific values of each threshold.
[0156] In an exemplary embodiment of the present invention, before S104, it can be determined whether the energy value of the subframe is less than a preset energy threshold; if it is less, the superframe to which the subframe belongs is determined to be a silent frame; if it is not less, then S104 and subsequent steps are executed.
[0157] For silent frames, there is no need to perform subsequent classification processing. In this embodiment, it is first determined whether it is a silent frame, and only if it is not a silent frame is it subjected to subsequent classification processing. The classification process is more reasonable and reduces the amount of data processing.
[0158] In an exemplary embodiment of the present invention, after S106, if the previous superframe of the superframe is a silent frame and the classification result of the superframe is different from the classification result of its next superframe, then the classification result of the superframe is modified to be the same as the classification result of its next superframe.
[0159] like Figure 3a As shown, if the previous superframe of this superframe is a SILENCE frame (silent frame), and the signal categories of the current superframe and the next superframe are different, then the category of the current superframe is forced to be the same as the category of the next superframe. Generally, the classification accuracy of superframes close to the SILENCE frame is low. In this embodiment, the classification results of superframes close to the SILENCE frame are corrected to further improve the accuracy of the classification results.
[0160] In an exemplary embodiment of the present invention, after S106, if the next superframe of the superframe is a silent frame and the classification result of the superframe is different from the classification result of its previous superframe, then the classification result of the superframe is modified to be the same as the classification result of its previous superframe.
[0161] like Figure 3bAs shown, if the current superframe is not a SILENCE frame, the next superframe of the current superframe is a SILENCE frame, and the signal category of the current superframe is different from that of the previous superframe, then the signal category of the current frame is forced to be the same as that of the previous frame. Generally, the classification accuracy of superframes close to the SILENCE frame is low. In this embodiment, the classification results of superframes close to the SILENCE frame are corrected to further improve the accuracy of the classification results.
[0162] In an exemplary embodiment of the present invention, after S106, if the classification results of the previous superframe and the next superframe are the same, and the classification results of the superframe are different from those of the previous and next superframes, then the classification result of the superframe is modified to be the same as the classification results of the previous and next superframes.
[0163] like Figure 3c As shown, if the previous superframe of the current superframe is not a SILENCE frame and has the same signal class as the next superframe, but the current superframe has a different signal class from the previous and next superframes, then the class of the current frame will be forced to be the same as the type of the previous and next superframes.
[0164] Generally, audio signals exhibit smoothness and continuity. If a frame differs in category from both its preceding and following frames, and none of them are silent frames, then the frame's category may be incorrectly classified. In this embodiment, considering the smoothness and continuity of the audio signal, the incorrectly classified superframe category is corrected, further improving the accuracy of the classification results.
[0165] In an exemplary embodiment of the present invention, after S106, if the superframe is a silent frame, and the classification results of the previous superframe and the next superframe are different, then the classification result of the superframe is modified to be the same as the classification result of its next superframe, such as... Figure 3d As shown.
[0166] Generally, audio signals exhibit smoothness and continuity. If a frame is a silent frame, but neither its preceding nor following frames are silent, the frame's category may be incorrectly classified. In this embodiment, considering the smoothness and continuity of the audio signal, the incorrectly classified superframe categories are corrected, further improving the accuracy of the classification results.
[0167] Figure 4 A second flowchart illustrating the audio classification method provided in this embodiment of the invention includes:
[0168] S401: Obtain the audio to be categorized.
[0169] S402: Perform frame segmentation on the audio to be classified to obtain multiple superframes. Each superframe includes multiple audio frames, and each audio frame includes multiple subframes.
[0170] For example, assuming that 2048 sample points are input as one frame, when the sampling rate of the signal is 32kHz, the length of one frame is 64ms; each frame is divided into 8 non-overlapping subframes, that is, one subframe includes 256 sample points, and the length of one subframe is 8ms; every 8 frames form a superframe, and the length of one superframe is 512ms.
[0171] S403: For each superframe, calculate the energy value of each subframe included in that superframe.
[0172] Continuing with the example above, suppose that a resampled frame x[n] is divided into 8 subframes, x[n] includes 2048 sample points, and each subframe includes 256 sample points. The energy value of each subframe m can be calculated using the following formula 1.
[0173]
[0174] Where k represents the sequence number of the audio frame included in the superframe, k = 0, 1, ..., 7, m represents the sequence number of the subframe included in the audio frame, n represents the sequence number of the sample point in the subframe, and E suber [k][m] represents the energy value of the m-th subframe in the k-th audio frame.
[0175] S404: Determine whether there is a subframe in the superframe with an energy value less than a preset energy threshold. If it exists, execute S405; otherwise, execute S406.
[0176] S405: This superframe is confirmed to be a silent frame.
[0177] S406: Calculate the average energy value of the superframe based on the energy value of each subframe included in the superframe.
[0178] The energy value of a superframe can be calculated using the following formula 2:
[0179]
[0180] S407: For each subframe in the superframe, compare the energy value of the subframe with 0.1 times the average energy value of the superframe to obtain the comparison result corresponding to the subframe.
[0181] For example, refer to Figure 2a and Figure 2b As shown, Figure 2a The image shows the energy distribution of three typical SPEECH signals. Figure 2b The image shows the energy distribution of three typical AUDIO signals. Figure 2a and Figure 2bThe horizontal axis represents the energy value range, and the vertical axis represents the proportion of subframes falling within the corresponding energy value range. On the horizontal axis, 1 represents 0.05E. aver 2 represents 0.1E aver ...40 represents 2E aver ...60 represents the maximum energy value E of the superframe. max In the example above, each superframe consists of 8 audio frames, and each audio frame consists of 8 subframes. In this case, the proportion of subframes on the vertical axis can be: the number of subframes in each superframe that fall within the corresponding energy value range / 8 * 8.
[0182] In one exemplary embodiment of the present invention, generation Figure 2a and Figure 2b The energy distribution shown, or in other words, the energy distribution of sample audio for each category, can be analyzed through the following steps:
[0183] Using the same framing method, the sample audio of each category is processed into frames. Each category of sample audio includes multiple superframes, each superframe includes multiple audio frames, and each audio frame includes multiple subframes.
[0184] For each category of sample audio, calculate the maximum energy value and average energy value of each superframe in the sample audio of that category; set each energy value interval based on the maximum energy value and the average energy value; and count the proportion of subframes in each energy value interval in the sample audio of that category.
[0185] The “same framing method” mentioned in this exemplary embodiment can be the same as the framing method in S402. It is still assumed that 2048 sample points are input as an audio frame. Each audio frame is resampled into a 32kHz signal, and then each frame signal is divided into 8 subframes. That is, the resampled frame x[n] is divided into 8 subframes. x[n] includes 2048 sample points, and each subframe includes 256 sample points. The 32kHz signal after resampling of every 8 frames forms a superframe.
[0186] Maximum energy value E of superframe max The average energy value E of a superframe can be understood as the maximum energy value among all subframes included in the superframe (or some subframes can be removed). aver It can be understood as the average energy value among all subframes included in the superframe (or some subframes can be removed).
[0187] The maximum energy value E of the superframe can be calculated using the following formula 3. max :
[0188] E max =max{E suber[k][m]}k=0,1,...7m=0,1,...7
[0189] Based on the maximum energy value E max and average energy value E aver Define energy value ranges; for example, you can define them based on the maximum energy value E. max The energy value range is set to 0-E. max According to the average energy value E aver Set the interval for each energy value range.
[0190] In one scenario, the energy value range from 0 to 2 times the average energy value can be defined with an interval of 0.05 times the average energy value. Conversely, the energy value range from 2 times the average energy value to the maximum energy value can be defined with an interval of 0.05 times the difference between the maximum energy value and the average energy value. In other words, for values not exceeding 2 times E... aver The energy, at 0.05E aver The energy distribution of each interval is statistically analyzed at intervals, for intervals greater than 2 times E. aver And less than E max The energy is 0.05*(E max -2*E aver The energy distribution of each interval is statistically analyzed.
[0191] The above-described energy value ranges are merely illustrative examples. This embodiment of the invention does not limit the specific settings of these energy value ranges.
[0192] In one exemplary embodiment of the present invention, setting the comparison conditions by comparing the energy distribution of sample audio in each category may include:
[0193] By comparing the energy distribution of sample audio in each category, the energy value that satisfies the preset difference condition for the subframe ratio difference is determined as the target energy value; the position of the target energy value in the energy value interval is determined as the target position.
[0194] The comparison condition is set as follows: the energy value of the subframe is compared with the energy value of the superframe at the target position in the energy value range.
[0195] By comparison Figure 2a and Figure 2b It can be seen that on the horizontal axis 1 (0.05E) aver )~3(0.15E aver Within this energy distribution range, the SPEECH and AUDIO signals show significant differences. Assuming the horizontal axis is 2 as the target energy value, denoted as F(2), the target energy value lies at 0.1E within the energy value range. averFor ease of description, the position within the energy value range is referred to as the target position. Thus, the comparison condition in S104 can be: compare the energy value of the subframe with the 0.1E value of the superframe. aver Compare them.
[0196] S408: Calculate the proportion of subframes in the superframe whose energy value is less than 0.1 times the average energy value of the superframe, and use this proportion as the first subframe proportion.
[0197] For example, if the energy value of a subframe is less than 0.1E of the superframe... aver The subframe can be marked as 1, otherwise it can be marked as 0. Then, the number of subframes marked as 1 in a superframe is counted, and the number is divided by 64 to get the proportion of the first subframe.
[0198] S409: Determine whether the proportion of the first subframe is less than the first classification threshold. If it is less, execute S410; if it is not less, execute S411.
[0199] Extensive experimental research has shown that the first classification threshold can be set to 0.005. Alternatively, other first classification thresholds can be set according to actual conditions. This embodiment of the invention does not limit the specific value of the first classification threshold.
[0200] S410: Determine that the superframe is a non-speech signal.
[0201] S411: Calculate the proportion of subframes in the superframe whose energy value is greater than (1 - 0.5 times the average energy value of the superframe) and use it as the proportion of the second subframe.
[0202] The energy distribution of most SPEECH conforms to Figure 2a As shown, most AUDIO signals conform to Figure 2b As shown, there are some special signals, such as castanets, whose energy distribution is as follows: Figure 2c As shown, the energy distribution of these special signals is similar to that of the SPEECH signal (similar in the larger part of the horizontal axis), but they actually belong to the AUDIO signal.
[0203] Depend on Figure 2c It can be seen that these special signals occupy a large proportion in the small portion of the horizontal axis; for example, the curve rises rapidly when the horizontal axis is less than 10, and then stabilizes and tends to become a straight line. Based on this, F(10) can be chosen as the energy value range to distinguish these special signals from the SPEECH signal. That is to say, the target position can also include F(10), which is 0.5 times the average energy value E. aver .
[0204] If the superframe is determined to be a SPEECH frame, the number of subframes in the superframe with energy greater than 1-F(10) can be counted and divided by 64 for normalization. The second classification threshold can be set to 0.05. If the proportion of the second subframes obtained after normalization is less than 0.05, the superframe is determined to be an AUDIO frame. Alternatively, other second classification thresholds can be set according to the actual situation. This embodiment of the invention does not limit the specific value of the second classification threshold.
[0205] S412: Determine whether the proportion of the second subframe is less than the second classification threshold. If it is less, execute S410; if it is not less, execute S413.
[0206] S413: Determine that the superframe is a voice signal.
[0207] Application of this invention Figure 4 In the illustrated embodiment, firstly, by analyzing and comparing the energy distribution of SPEECH and AUDIO signals, a comparison condition capable of distinguishing between SPEECH and AUDIO signals is set. Based on this comparison condition and the set classification threshold, it is determined whether the audio to be classified is a SPEECH signal or an AUDIO signal, without needing to use different encoding and decoding methods to process the audio, thus reducing the amount of data processing. Secondly, it can reduce the interference of special signals such as castanets on signal classification, further improving the accuracy of the classification results.
[0208] To achieve the above objectives, embodiments of the present invention also provide an audio classification device, such as... Figure 5 As shown, it includes:
[0209] The first acquisition module 501 is used to acquire audio to be classified;
[0210] Frame segmentation module 502 is used to perform frame segmentation processing on the audio to be classified to obtain multiple superframes, each superframe including multiple audio frames, and each audio frame including multiple subframes.
[0211] The calculation module 503 is used to calculate the energy value of each superframe.
[0212] The first comparison module 504 is used to compare the energy value of each subframe in the superframe with the energy value of the superframe according to the set comparison conditions, and obtain the comparison result corresponding to the subframe.
[0213] The quantization module 505 is used to quantize the comparison results corresponding to each subframe in the superframe to obtain the quantization result.
[0214] The second comparison module 506 is used to compare the quantization result with a set classification threshold, and determine the classification result of the superframe based on the comparison result.
[0215] In one exemplary embodiment of the present invention, the apparatus further includes: a second acquisition module, a first statistics module, and a setting module (not shown in the figure), wherein,
[0216] The second acquisition module is used to acquire sample audio from multiple known categories;
[0217] The first statistical module is used to statistically analyze the energy distribution of sample audio for each category, including the proportion of subframes located in each energy value range.
[0218] The setting module is used to set the comparison conditions by comparing the energy distribution of sample audio in each category.
[0219] In one exemplary embodiment of the present invention, the first statistical module includes:
[0220] The framing submodule is used to perform framing processing on sample audio of each category using the same framing method. Each category of sample audio includes multiple superframes, each superframe includes multiple audio frames, and each audio frame includes multiple subframes.
[0221] The calculation submodule is used to calculate the maximum energy value and average energy value of each superframe in the sample audio of each category;
[0222] A setting submodule is used to set each energy value range based on the maximum energy value and the average energy value;
[0223] The statistics submodule is used to calculate the proportion of subframes in each energy value range of the sample audio for this category.
[0224] In one exemplary embodiment of the present invention, the setting module is specifically used for:
[0225] By comparing the energy distribution of sample audio in each category, the energy value that meets the preset difference condition for the subframe ratio difference is determined as the target energy value;
[0226] Determine the position of the target energy value within the energy value range, and use this position as the target location;
[0227] The comparison condition is set as follows: the energy value of the subframe is compared with the energy value of the superframe at the target position in the energy value range.
[0228] In one exemplary embodiment of the present invention, the setting submodule is specifically used for:
[0229] With an interval of 0.05 times the average energy value, set the energy value range between 0 and twice the average energy value; with an interval of 0.05 times the difference between the maximum energy value and the average energy value, set the energy value range between twice the average energy value and the maximum energy value.
[0230] The energy value of the superframe at the target position within the energy value range is 0.1 times the average energy value of the superframe;
[0231] The quantization module 505 is specifically used to: count the proportion of subframes in the superframe whose energy value is less than 0.1 times the average energy value of the superframe, and use it as the first subframe proportion;
[0232] The second comparison module 506 is specifically used to: determine whether the proportion of the first subframe is less than the first classification threshold; if it is less, then trigger the first determination module; if it is not less, then trigger the second determination module.
[0233] The first determining module (not shown in the figure) is used to determine that the superframe is a non-speech signal;
[0234] The second determining module (not shown in the figure) is used to determine that the superframe is a voice signal.
[0235] In one exemplary embodiment of the present invention, the target location further includes 0.5 times the average energy value;
[0236] The device further includes: a second statistical module and a first judgment module (not shown in the figure), wherein,
[0237] The second statistics module is used to, when it is determined that the proportion of the first subframe is not less than the first classification threshold, count the proportion of subframes in the superframe whose energy value is greater than 0.5 times the average energy value of the superframe, and use this as the second subframe proportion.
[0238] The first determination module is used to determine whether the proportion of the second subframe is less than the second classification threshold. If it is less, the first determination module is triggered; otherwise, the second determination module is triggered.
[0239] In one exemplary embodiment of the present invention, the device further includes: a second determination module and a third determination module (not shown in the figure), wherein,
[0240] The second determination module is used to determine whether the proportion of the first subframe is not less than a third classification threshold when the proportion of the first subframe is not less than a first classification threshold and the classification results of a preset number of superframes before the superframe are all non-speech signals. If so, the second determination module is triggered. The third classification threshold is greater than the first classification threshold.
[0241] The third judgment module is used to determine whether the proportion of the first subframe is not less than the fourth classification threshold when the proportion of the first subframe is less than the first classification threshold and the classification results of the preset number of superframes before the superframe are all speech signals. If so, the second determination module is triggered, wherein the fourth classification threshold is less than the first classification threshold.
[0242] In one exemplary embodiment of the present invention, the apparatus further includes: a fourth judging module and a third determining module (not shown in the figure), wherein,
[0243] The fourth judgment module is used to determine whether the energy value of the subframe is less than a preset energy threshold; if it is less, the third determination module is triggered; if it is not less, the first comparison module is triggered.
[0244] The third determining module is used to determine whether the superframe to which the subframe belongs is a silent frame;
[0245] In one exemplary embodiment of the present invention, the apparatus further includes:
[0246] The first modification module (not shown in the figure) is used to modify the classification result of the superframe to be the same as the classification result of the next superframe if the previous superframe of the superframe is a silent frame and the classification result of the superframe is different from the classification result of the next superframe.
[0247] And / or,
[0248] If the next superframe of a superframe is a silent frame, and the classification result of the superframe is different from the classification result of its previous superframe, then the classification result of the superframe is modified to be the same as the classification result of its previous superframe.
[0249] In one exemplary embodiment of the present invention, the apparatus further includes:
[0250] The second modification module (not shown in the figure) is used to modify the classification result of the superframe to be the same as the classification result of the previous superframe and the next superframe if the classification result of the superframe is the same as that of the previous superframe and the next superframe, and the classification result of the superframe is different from that of the previous superframe and the next superframe.
[0251] This invention also provides an electronic device, such as... Figure 6 As shown, it includes a processor 601 and a memory 602.
[0252] Memory 602 is used to store computer programs;
[0253] The processor 601, when executing the program stored in the memory 602, implements any of the above-mentioned audio classification methods.
[0254] The memory mentioned in the aforementioned electronic device may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0255] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0256] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements any of the above-described audio classification methods.
[0257] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the above-described audio classification methods.
[0258] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0259] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0260] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments, equipment embodiments, computer-readable storage medium embodiments, and computer program product embodiments are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0261] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. An audio classification method, comprising: Get the audio to be categorized; The audio to be classified is subjected to frame segmentation to obtain multiple superframes. Each superframe includes multiple audio frames, and each audio frame includes multiple subframes. For each superframe, calculate the energy value of that superframe; For each subframe in the superframe, the energy value of the subframe is compared with the energy value of the superframe according to the set comparison conditions to obtain the comparison result corresponding to the subframe. The comparison results corresponding to each subframe in the superframe are quantized to obtain the quantization results; The quantization result is compared with the set classification threshold, and the classification result of the superframe is determined based on the comparison result. The process of setting the comparison conditions includes: acquiring sample audio from multiple known categories; statistically analyzing the energy distribution of sample audio from each category, including the proportion of subframes located in each energy value range; and setting the comparison conditions by comparing the energy distribution of sample audio from each category. The step of statistically analyzing the energy distribution of sample audio for each category includes: performing frame segmentation on sample audio for each category using the same framing method, with each category of sample audio including multiple superframes, each superframe including multiple audio frames, and each audio frame including multiple subframes; calculating the maximum energy value and average energy value of each superframe in the sample audio for each category; setting energy value intervals based on the maximum energy value and the average energy value; and statistically analyzing the proportion of subframes in each energy value interval in the sample audio for that category. The step of setting the comparison conditions by comparing the energy distribution of sample audio of each category includes: determining the energy value of the subframe ratio difference that meets the preset difference condition by comparing the energy distribution of sample audio of each category, and taking it as the target energy value; determining the position of the target energy value in the energy value interval, and taking it as the target position; and setting the comparison condition as: comparing the energy value of the subframe with the energy value of the superframe at the target position in the energy value interval.
2. The method according to claim 1, wherein, The step of setting each energy value range based on the maximum energy value and the average energy value includes: With an interval of 0.05 times the average energy value, set the energy value range between 0 and twice the average energy value; with an interval of 0.05 times the difference between the maximum energy value and the average energy value, set the energy value range between twice the average energy value and the maximum energy value. The energy value of the superframe at the target position within the energy value range is 0.1 times the average energy value of the superframe; The step of quantizing the comparison results corresponding to each subframe in the superframe to obtain the quantization result includes: The proportion of subframes in the superframe whose energy value is less than 0.1 times the average energy value of the superframe is counted and used as the proportion of the first subframe. The step of comparing the quantization result with a set classification threshold and determining the classification result of the superframe based on the comparison result includes: Determine whether the proportion of the first subframe is less than the first classification threshold. If it is less, the superframe is determined to be a non-speech signal; if it is not less, the superframe is determined to be a speech signal.
3. The method according to claim 2, wherein, The target location also includes 0.5 times the average energy value; If the proportion of the first subframe is determined to be not less than the first classification threshold, the method further includes: The proportion of subframes in the superframe whose energy value is greater than 0.5 times the average energy value of the superframe is counted and used as the proportion of the second subframe; Determine whether the proportion of the second subframe is less than the second classification threshold. If it is less, determine that the superframe is a non-speech signal; otherwise, determine that the superframe is a speech signal.
4. The method according to claim 2, wherein, If the proportion of the first subframe is determined to be not less than the first classification threshold, the method further includes: If the classification results of the previous preset number of superframes are all non-speech signals, then if the proportion of the first subframe is not less than the third classification threshold, the superframe is determined to be a speech signal, where the third classification threshold is greater than the first classification threshold. If the proportion of the first subframe is determined to be less than the first classification threshold, the method further includes: If the classification results of the previous preset number of superframes are all speech signals, then if the proportion of the first subframe is not less than the fourth classification threshold, the superframe is determined to be a speech signal, where the fourth classification threshold is less than the first classification threshold.
5. The method according to claim 1, wherein, Before comparing the energy value of the subframe with the energy value of the superframe according to the set comparison conditions to obtain the comparison result corresponding to the subframe, the method further includes: Determine whether the energy value of the subframe is less than a preset energy threshold; If it is less than, then the superframe to which this subframe belongs is determined to be a silent frame; If the value is not less than the set value, the step of comparing the energy value of the subframe with the energy value of the superframe according to the set comparison conditions is performed to obtain the comparison result corresponding to the subframe.
6. The method according to claim 5, wherein, After determining the classification result of the superframe, the process also includes: If the previous superframe of this superframe is a silent frame, and the classification result of this superframe is different from the classification result of its next superframe, then the classification result of this superframe is modified to be the same as the classification result of its next superframe. And / or, If the next superframe of a superframe is a silent frame, and the classification result of the superframe is different from the classification result of its previous superframe, then the classification result of the superframe is modified to be the same as the classification result of its previous superframe.
7. The method according to claim 1, wherein, After determining the classification result of the superframe, the process also includes: If the classification results of the previous and next superframes of a superframe are the same, and the classification results of the superframe are different from those of the previous and next superframes, then the classification result of the superframe is modified to be the same as those of the previous and next superframes.
8. An audio classification device, comprising: The first acquisition module is used to acquire the audio to be classified. The frame segmentation module is used to perform frame segmentation processing on the audio to be classified to obtain multiple superframes. Each superframe includes multiple audio frames, and each audio frame includes multiple subframes. The calculation module is used to calculate the energy value of each superframe. The first comparison module is used to compare the energy value of each subframe in the superframe with the energy value of the superframe according to the set comparison conditions, and obtain the comparison result corresponding to the subframe. The quantization module is used to quantize the comparison results corresponding to each subframe in the superframe to obtain the quantization result. The second comparison module is used to compare the quantization result with the set classification threshold, and determine the classification result of the superframe based on the comparison result. The device further includes: a second acquisition module for acquiring sample audio of multiple known categories; a first statistics module for statistically analyzing the energy distribution of sample audio of each category, wherein the energy distribution includes the proportion of subframes located in each energy value range; and a setting module for setting the comparison conditions by comparing the energy distribution of sample audio of each category. The setting module is specifically used for: determining the energy value of the subframe ratio difference that meets the preset difference condition by comparing the energy distribution of sample audio of each category, and taking it as the target energy value; determining the position of the target energy value in the energy value interval, and taking it as the target position; setting the comparison condition as: comparing the energy value of the subframe with the energy value of the superframe at the target position in the energy value interval; The first statistics module includes: a framing submodule, used to perform framing processing on sample audio of each category using the same framing method, wherein each category of sample audio includes multiple superframes, each superframe includes multiple audio frames, and each audio frame includes multiple subframes; a calculation submodule, used to calculate the maximum energy value and average energy value of each superframe in the sample audio of each category; a setting submodule, used to set each energy value interval according to the maximum energy value and the average energy value; and a statistics submodule, used to count the proportion of subframes in each energy value interval in the sample audio of that category.
9. The apparatus according to claim 8, wherein, The setting submodule is specifically used for: With an interval of 0.05 times the average energy value, set the energy value range between 0 and twice the average energy value; with an interval of 0.05 times the difference between the maximum energy value and the average energy value, set the energy value range between twice the average energy value and the maximum energy value. The energy value of the superframe at the target position within the energy value range is 0.1 times the average energy value of the superframe; The quantization module is specifically used to: count the proportion of subframes in the superframe whose energy value is less than 0.1 times the average energy value of the superframe, and use this proportion as the first subframe proportion; The second comparison module is specifically used to: determine whether the proportion of the first subframe is less than the first classification threshold; if it is less, then trigger the first determination module; if it is not less, then trigger the second determination module. The first determining module is used to determine that the superframe is a non-speech signal; The second determining module is used to determine that the superframe is a voice signal.
10. The apparatus according to claim 9, wherein, The target location also includes 0.5 times the average energy value; The device further includes: The second statistics module is used to, when it is determined that the proportion of the first subframe is not less than the first classification threshold, count the proportion of subframes in the superframe whose energy value is greater than 0.5 times the average energy value of the superframe, and use this as the second subframe proportion. The first determination module is used to determine whether the proportion of the second subframe is less than the second classification threshold. If it is less, the first determination module is triggered; otherwise, the second determination module is triggered.
11. The apparatus according to claim 9, wherein, The device further includes: The second determination module is used to determine whether the proportion of the first subframe is not less than a third classification threshold when the proportion of the first subframe is not less than a first classification threshold and the classification results of a preset number of superframes before the superframe are all non-speech signals. If so, the second determination module is triggered. The third classification threshold is greater than the first classification threshold. The third judgment module is used to determine whether the proportion of the first subframe is not less than the fourth classification threshold when the proportion of the first subframe is less than the first classification threshold and the classification results of the preset number of superframes before the superframe are all speech signals. If so, the second determination module is triggered, wherein the fourth classification threshold is less than the first classification threshold.
12. The apparatus according to claim 8, wherein, The device further includes: The fourth judgment module is used to determine whether the energy value of the subframe is less than a preset energy threshold; if it is less, the third determination module is triggered; if it is not less, the first comparison module is triggered. The third determining module is used to determine whether the superframe to which the subframe belongs is a silent frame.
13. The apparatus according to claim 12, wherein, The device further includes: The first modification module is used to modify the classification result of the superframe to be the same as the classification result of the next superframe if the previous superframe of the superframe is a silent frame and the classification result of the superframe is different from the classification result of the next superframe. And / or, If the next superframe of a superframe is a silent frame, and the classification result of the superframe is different from the classification result of its previous superframe, then the classification result of the superframe is modified to be the same as the classification result of its previous superframe.
14. The apparatus according to claim 8, wherein, The device further includes: The second modification module is used to modify the classification result of the superframe to be the same as the classification result of the previous superframe and the next superframe if the classification result of the superframe is the same and the classification result of the superframe is different from both the previous and the next superframe.
15. An electronic device, comprising a processor and a memory; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-7.
16. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-7.
Citation Information
Patent Citations
Audio comparison system and audio energy comparison method thereof
CN101593517A
Classification identifying method and equipment of audio signals
CN102446506A