Audio compression is data compression designed to reduce the transmission bandwidth requirement of digital audio streams and the storage size of audio files. Broadly compression techniques are classified into two types:
  1. Lossless compression algorithms usually exploit statistical redundancy in such a way as to represent the sender's data more concisely without error. Lossless compression schemes are reversible so that the original data can be reconstructed
  2. Lossy schemes accept some loss of data in order to achieve higher compression.

In both lossy and lossless compression, information redundancy is reduced, using methods such as coding, pattern recognition and linear prediction to reduce the amount of information used to represent the uncompressed data.

There are numerous methods of compressing audio files. The Discrete Cosine Transform is a lossy technique that removes certain frequencies from the audio data such that the size is reduced with reasonable quality.

The Discrete Cosine Transform is a first-level approximation to mpeg audio compression, which are more sophisticated forms of the basic principle used in DCT.

This discrete cosine Transform Audio Compression is performed in  MATLAB.

It takes a wave file as input, compress it to different levels and assess the output that is each compressed wave file. The difference in their frequency spectra will be viewed to assess how different levels of compression affect the audio signals.

PROGRAM WORKING:-

An audio waveform is a continuous sequence of data in one long vector. In that sense, an audio data structure is different from an image data structure. We will need to apportion the vector manually into several pieces, and cannot rely on existing rows or columns.
  • Read the audio file
  • Determine a value for the number of samples that will undergo a DCT at once. In other words, the audio vector will be divided into pieces of this length.
  • Again, we examine at different compression rates:

50%
75%
87.5%
  • Resulting compressed-and-uncompressed audio waves

For simplicity, we iterate over the vector, window-by-window, but we discard whatever remainder exists:
Now we plot the time domain signals


However, closer inspection does reveal qualitative differences in the densely packed regions (high frequencies).
A look at the spectrogram reveals a clear idea of the loss of high frequencies.



The qualitative difference is clearly apparent when listening to the audio files
  • Saving the files and viewing the difference in size


CODE

%read a file and convert it to a vector

%chosing a block size

%changing compression  percentages

%initializing compressed matrice

%actual compression

%plotting audio signals

%expanded view of audio signals

%spectrogram of audio signals

%playing files

 The MATLAB code and related files can be downloaded here:-

Categories: ,

17 Responses so far.

  1. Unknown says:

    I can not download.
    please send me that matlab code file.
    loveho2000@naver.com

  2. Unknown says:

    thanks ..it was of great help for us:):) i could download only one file please upload other files too.. i would be glad to you

  3. Unknown says:

    Great code. really helpful for students, but if I may ask if you have the corresponding decompressing code for this? :D Thanks sir.

  4. Unknown says:

    i cannot see that did not open in plz send me my mail id jillu.be12@gmail.com

  5. Unknown says:

    plz sir urgent so immediately send my id that matlap programs

  6. MASH says:

    The download link is working fine. check it again

  7. Unknown says:

    terima kasih , ini sangat membantu saya...menyelesaikan tugas studi ....

  8. Unknown says:

    Code works fine Thanks. But how to decompress the compressed audio

  9. Unknown says:

    but the orizinal is for 17 sec where as the output files are for 47 sec

  10. mLundy says:

    thank you for your code, may i ask you how about decompress the compressed audio?

  11. chintu says:
    This comment has been removed by the author.
  12. chintu says:

    Can u please provide the actual Matlab code

  13. Unknown says:

    Can please anyone help me in

  14. Unknown says:

    Is this code perfectly running?

  15. Unknown says:

    Can u please help me in running this code in MATLAB 2014.

  16. Unknown says:

    What does it mean with error "Undefined function or variable 'wavread'.

    Error in myDCT (line4)
    [funky, f] = wavread('funky.wav');

    What must I do to eliminate this error sir, thank u and God bless you

Leave a Reply