This project explores audio compression and transformation techniques using Python. It involves speeding up an audio file, compressing it, and then restoring the original quality(not yet ..!) and length. The project utilizes libraries such as librosa, soundfile, and pydub to perform these operations.
- Worker Algorithm: Speeds up the audio, compresses it using FLAC (lossless format), and saves the transformation data.
- Observer Algorithm: Decompresses the audio, restores the original length and quality(Not yet), and saves the result.
To set up the project, follow these steps:
-
Clone the Repository:
git clone https://github.com/yourusername/audcomp.git cd audcomp -
Create and Activate a Virtual Environment:
python3 -m venv venv # For Unix-based systems source venv/bin/activate # For Windows venv\Scripts\activate
-
Install Dependencies:
pip3 install -r requirements.txt
-
Ensure FFmpeg is Installed: This project uses
pydub, which requires FFmpeg. Install it using:# For Ubuntu/Debian sudo apt-get install ffmpeg # For macOS brew install ffmpeg
Run
python3 app.py-
Worker Algorithm: This will process an input audio file (
piano-88-bpm.wav), speed it up, compress it, and save the result asoutput_fast.flac. It also prints out file sizes and durations. -
Observer Algorithm: This will decompress the FLAC file, restore the original audio quality(not yet) and length, and save the restored file as
restored.wav. -
Output files on project folder There will be 2 more files generated in the project folder:
output_fast.flac,restored.wav
app.py: Contains the main algorithms for processing audio.requirements.txt: Lists project dependencies.piano-88-bpm.wav: Test audio loop made with Bitwig