Skip to content

Utilizing Singular Value Decomposition (SVD) for audio compression: Convert audio to spectrograms, apply SVD for dimension reduction, and reconstruct with Griffin-Lim. High compression, minimal quality loss.

License

Notifications You must be signed in to change notification settings

mich1803/SVD-Audio-Compression

Repository files navigation

Repository banner

🎶🗜️ SVD Audio Compression

Leverage Singular Value Decomposition (SVD) for audio compression, aiming to efficiently reduce audio file sizes while maintaining high sound quality. This project uses the mathematical properties of SVD to achieve significant compression ratios without compromising audio integrity. It explores various levels of decomposition and reconstruction to find the optimal balance between compression ratio and audio fidelity.


Contents

How does SVD on audio works

The project converts audio signals into spectrograms, applies Singular Value Decomposition to compress the data, and reconstructs the audio from the compressed spectrogram. The steps include:

  1. Audio to Spectrogram: Transform the audio signal into its spectrogram representation using Short-Time Fourier Transform (STFT). This breaks down the audio into time-frequency components.
  2. Spectrogram to SVD: Decompose the spectrogram matrix using SVD, which separates it into singular vectors and values, allowing the reduction of dimensionality.
  3. SVD to Spectrogram: Truncate the singular values to compress the spectrogram data. The number of singular values retained determines the compression level and quality.
  4. Spectrogram to Audio: Reconstruct the audio signal from the compressed spectrogram using the Griffin-Lim algorithm.

Memory Space Analysis

In this project, an analysis of the memory space saved by using SVD for audio compression is also included. This involves comparing the original size of audio files to their compressed versions, taking into account various levels of singular value truncation. The analysis highlights the trade-off between compression ratio and audio quality, providing insights into the effectiveness of SVD in reducing storage requirements without significant loss of sound fidelity.


How to Use

On Google Colab:

  1. Open the notebook on Google Colab.
  2. Upload the audio file you want to compress to the file section.
  3. Modify the filename in the code if you want to match your uploaded file.

Locally:

  1. Install the requirements with pip install -r requirements.txt in your virtual environment.
  2. Open the SVD-AudioCompression.ipynb notebook in your IDE.
  3. Change the filename if you want to point to your audio file.

Matlab:

There is also a (worse performing) matlab version of the code

  1. Download the file in matlab/SVD_AudioCompression.m.
  2. Install the add-on Signal Processing Toolbox.
  3. Run with the song you want changing the filename at the beginning of the script.

About

Utilizing Singular Value Decomposition (SVD) for audio compression: Convert audio to spectrograms, apply SVD for dimension reduction, and reconstruct with Griffin-Lim. High compression, minimal quality loss.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published