The present disclosure relates to an audio compression method, and more particularly to an audio compression method for improving a compression ratio.
Numerous data compression techniques have been devised to compress files such as to facilitate efficient storage management and data transmission over communication lines. Data compression techniques have long been used for speeding up data transfer, by reducing the amount of space taken up by information being sent.
In response to the above-referenced technical inadequacies, the present disclosure provides an audio compression method for improving a compression ratio. The audio compression method includes the following steps: obtaining an audio frame including an audio signal having a plurality of waveforms; selecting one of multiple pieces of audio data of the audio frame as next audio data; obtaining a plurality of audio values of the audio data of the audio frame that are generated before the next audio data is generated, as a plurality of reference audio values; predicting an audio value of the next audio data as a predicted audio value, according to the plurality of reference audio values; obtaining the audio value of the next audio data, as an actual audio value; calculating a difference between the predicted audio value and the actual audio value corresponding thereto, as a first audio error value; and compressing the first audio error value.
The described embodiments may be better understood by reference to the following description and the accompanying drawings, in which:
Reference is made to
The audio compression method may include steps S101 to S113 as shown in
In step S101, the processor circuit 10 obtains audio data of an audio frame including an audio signal having a plurality of waveforms.
In step S103, the processor circuit 10 selects one of multiple pieces of audio data of the audio frame as next audio data.
In step S105, the processor circuit 10 obtains a plurality of audio values of the audio data that are generated before the next audio data is generated, as a plurality of reference audio values.
In step S107, the processor circuit 10 predicts an audio value of the next audio data as a predicted audio value according to the plurality of reference audio values.
In step S109, the processor circuit 10 obtains the audio value of the next audio data, as an actual audio value. The processor circuit 10 outputs the actual audio value to the calculating circuit 20.
In step S111, the calculating circuit 20 calculates a difference between predicted audio value and the actual audio value corresponding thereto, as a first audio error value. The calculating circuit 20 outputs the first audio error value to the compressor circuit 30.
In step S113, the compressor circuit 30 compresses the first audio error value.
Reference is made to
The audio compression method may further include steps S201 to S205 as shown in
In step S201, the processor circuit 10 sets a preset reduction ratio according to (audio values, energy or a data length of) the audio data, and outputs the preset reduction ratio to the calculating circuit 20.
In step S203, the calculating circuit 20 divides the first audio error value by the preset reduction ratio to obtain a second audio error value. The second audio error value is smaller than the first audio error value.
In step S205, the compressor circuit 30 compresses the second audio error value from the calculating circuit 20.
Reference is made to
After the first audio error value is calculated in step S111, step S301 and then step S113 or steps S201 to S205 may be performed by the audio compression system 1000 as shown in
In step S301, the processor circuit 10 determines whether or not the first audio error value is lower than an audio error threshold. If the processor circuit 10 determines that the first audio error value is lower than the audio error threshold, the compressor circuit 30 compresses the first audio error value in step S113 as described above.
Conversely, if the processor circuit 10 determines that the first audio error value is not lower than the audio error threshold, the compressor circuit 30 compresses the second audio error value in steps S201 to S205 as described above.
Reference is made to
The audio compression method may further include steps S601 to S603 as shown in
In step S601, the calculating circuit 20 calculates an energy value of the audio signal in the audio frame as a first energy value.
In step S603, the processor circuit 10 determines whether or not the first energy value is lower than the energy value threshold. If the processor circuit 10 determines that the first energy value is lower than the energy value threshold, steps S105 to S113 are sequentially performed as described above. In step S113, the compressor circuit 30 compresses the first audio error value.
Conversely, steps S105 to S111 and steps S201 to S205 are sequentially performed as described above. In step S205, the compressor circuit 30 compresses the second audio error value.
Reference is made to
The audio compression method may further include steps S701 to S707 that may be performed by the audio compression system 1000 after step S103 is performed.
In step S701, the calculating circuit 20 calculates a first energy value of the audio signal in the audio frame.
In step S703, the calculating circuit 20 calculates a second energy value of the audio signal of the audio data in at least parts of the previous audio frame.
In step S705, the calculating circuit 20 adds up the first energy value and the second energy value to obtain a total energy value.
In step S707, the calculating circuit 20 determines whether or not the total energy value is lower than the energy value threshold. If the calculating circuit 20 determines that the total energy value is lower than the energy value threshold, steps S105 to S113 are sequentially performed as described above. In step S113, the compressor circuit 30 compresses the first audio error value.
Conversely, steps S105 to S113 and steps S201 to S205 are sequentially performed as described above. In step S205, the compressor circuit 30 compresses the second audio error value.
The first energy value described herein may be calculated as follows. The calculating circuit 20 calculates a squared value of an amplitude of each of the plurality of waveforms of the audio signal in the audio frame. Then, the calculating circuit 20 adds up the squared values of the plurality of waveforms of the audio signal to obtain a total energy value. Then, the calculating circuit 20 divides the first energy value by a number of the plurality of waveforms of the audio signal in the audio frame to obtain an energy average value. Finally, the calculating circuit 20 calculates a logarithm of the energy average value to obtain the first energy value of the audio frame. The second energy value may also be calculated in a similar manner.
Reference is made to
The audio compression method may further include steps S803 to S805 as shown in
In step S803, the processor circuit 10 determines whether or not a data length of the original audio compressed data of the first audio error value is lower than an audio data length threshold.
If the processor circuit 10 determines that the data length of the original audio compressed data of the first audio error value is not lower than the audio data length threshold, steps S201 to S205 may be performed. In step S205, the compressor circuit 30 compresses the second audio error value that is equal to the first audio error value divided by the preset reduction ratio. Conversely, any step is not then performed.
Alternatively, the compressor circuit 30 compresses the audio data of the audio frame to generate original audio compressed data. If the processor circuit 10 determines that the data length of the original audio compressed data of the audio data is not lower than the audio data length threshold, the compressor circuit 30 compresses the first audio error value or the second audio error value.
In conclusion, the present disclosure provides the audio compression method for improving the compression ratio. The first audio error value between the predicted audio value and the actual audio value, or the second audio error value that is equal to the first audio error value divided by preset reduction ratio, can be compressed by the audio compression method of the present disclosure. Therefore, the data length of the compressed data can be reduced, thereby improving the compression ratio of compressing the audio data.
The foregoing description of the exemplary embodiments of the disclosure has been presented only for the purposes of illustration and description and is not intended to be exhaustive or to limit the disclosure to the precise forms disclosed. Many modifications and variations are possible in light of the above teaching.
The embodiments were chosen and described in order to explain the principles of the disclosure and their practical application so as to enable others skilled in the art to utilize the disclosure and various embodiments and with various modifications as are suited to the particular use contemplated. Alternative embodiments will become apparent to those skilled in the art to which the present disclosure pertains without departing from its spirit and scope.