What methods can be used for lossless audio compression?
조회 수: 10 (최근 30일)
이전 댓글 표시
Hi everyone
What methods can be used for lossless audio compression?
I've read that RLW, LZW, Arithmetic encoding, Huffman coding, Shannon Fano coding are the algorithm used in the lossless method
But where can we find the matlab code for the algorithm ?
thank you
댓글 수: 0
답변 (2개)
Akira Agata
2021년 9월 11일
This function can save data as WAVE (.wav) or FLAC (.flac) file, both are typical lossless audio format.
댓글 수: 0
Walter Roberson
2021년 9월 11일
Any deterministic function that does one-to-one and on-to mappings, and makes at least one input shorter to represent on output by at least one bit, is a lossless compression algorithm.
The one-to-one and on-to means that a given input always becomes the same output and that no two different inputs become the same output.
There are an endless number of lossless compression algorithms.
The trick for lossless compression algorithms is finding one that compresses well on a "useful" set of data. A great algorithm for jackhammer noise might not be good for speech or classical music. It would be reasonable to expect that if you had ultrasound recordings of bats then you might want a different algorithm than for that
댓글 수: 1
Walter Roberson
2021년 9월 11일
Example of a valid lossless compression algorithm:
if regexp(LineToCompress, '#+T1D')
output = '#' + LineToCompress'
elseif strcmp(LineToCompress, 'You take one down, and pass it around!')
output = '#T1D'
else
output = LineToCompress
end
and that would act to transform
99 bottles of beer on the wall!
99 bottles of beer!
You take one down, and pass it around!
98 bottles of beer on the wall!
98 bottles of beer on the wall!
98 bottles of beer!
You take one down, and pass it around!
97 bottles of beer on the wall!
97 bottles of beer on the wall!
97 bottles of beer!
#T1D
96 bottles of beer on the wall!
into
99 bottles of beer on the wall!
99 bottles of beer!
#T1D
98 bottles of beer on the wall!
98 bottles of beer on the wall!
98 bottles of beer!
#T1D
97 bottles of beer on the wall!
97 bottles of beer on the wall!
97 bottles of beer!
##T1D
96 bottles of beer on the wall!
Notice that the third stanza got longer, the input #T1D expanding to ##T1D . But the first two stanzas each got shorter, so there is overall compression.
You could do exactly the same kind of thing with audio. You could recognize an exact copy of the sound corresponding to the sung "You take one down, and pass it around!", and provided that the inputs had exactly the same sound (copied), you could replace it with a sung "T1D!". Such a simple algorithm by itself would be useless in real life, as people are not going to sing the phrase exactly the same way at exactly the right sample times, not in real life.
However, the principle holds: you can recognize something about sound and encode it. For example there could plausibly be a situation in which a piece of equipment emitted a sine wave at 378 Hz that holds steady at a volume for a few seconds at a time before changing. The algorithm could detect stretches of 378 Hz and constant volume, and subtract that out and insert some bits saying "volume 58 duration 482 samples" and the rest of the stream could be encoding any minor differences from that. Would this be generally useful? NO -- but as long as it can exactly reproduce any sound, and it makes at least one situation shorter, it counts as lossless audio compression.
... And that should make it more clear that there is an endless number of lossless audio compression algorithms.
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulation, Tuning, and Visualization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!