This project provides a complete workflow for enhancing audio files using resemble-enhance, with support for various input and output formats.
The workflow consists of four main steps:
- Convert input audio file(s) to WAV format
- Enhance the audio using resemble-enhance
- Convert the enhanced audio to the desired output format
- Save (together with original metadata) the enhanced audio to destination directory
./run.sh <source_dir> <target_dir> [format] [quality]source_dir(required): Directory containing input audio filestarget_dir(required): Directory for final processed audio filesformat(optional): Output format (defaults to flac)quality(optional): Audio quality for lossy formats (defaults to 256k)
# Process with default settings (FLAC output)
./run.sh input_dir output_dir
# Process to MP3 with specific quality
./run.sh input_dir output_dir mp3 320k
# Process to WAV
./run.sh input_dir output_dir wav
# Process to Opus
./run.sh input_dir output_dir opus 128k- MP3, M4A, AAC, FLAC, OGG, WMA, AIFF, AU, RA, 3GP, AMR, OPUS, WAV
- FLAC (default, lossless)
- MP3 (with libmp3lame)
- AAC
- OGG (with libvorbis)
- M4A (AAC in MP4 container)
- WAV (PCM 16-bit 44.1kHz)
- OPUS (with libopus)
Processing time depends on your hardware. As a reference:
- GPU: GeForce RTX 3060 Ti: Approximately 1 hour of processing time per hour of audio
- CPU: 2,3 GHz I’m 8-Core intel Core i9: Approximately 11 hours of processing time per hour of audio
- Linux operating system or wsl (this script uses bash and Linux-specific commands)
- Python 3.10
- ffmpeg (for audio conversion)
- resemble-enhance (for audio enhancement)
-
Install ffmpeg:
# Ubuntu/Debian sudo apt update && sudo apt install ffmpeg # Other Linux distributions # Use your distribution's package manager (yum, pacman, zypper, etc.)
-
Create and activate a Python virtual environment:
python3.10 -m venv .venv source .venv/bin/activate -
Install resemble-enhance:
pip install resemble-enhance
-
Make the script executable:
chmod +x run.sh
run.sh: Main orchestration scriptscripts/convert_audio_to_wav.py: Converts various audio formats to WAVscripts/convert_wav_to_format.py: Converts WAV files to target format
- Audio Conversion: All input files are converted to WAV format (16-bit, 44.1kHz)
- Enhancement: resemble-enhance processes the WAV files for noise reduction and quality improvement
- Format Conversion: Enhanced WAV files are converted to the specified output format and quality
- Cleanup: Temporary files are cleaned up (with user confirmation for enhanced WAV files)
Quality settings are only applicable for lossy formats:
- MP3: 128k, 192k, 256k, 320k
- AAC: 128k, 192k, 256k, 320k
- OGG: 128k, 192k, 256k, 320k
- Opus: 64k, 96k, 128k, 192k
Lossless formats (FLAC, WAV) do not use quality settings.
- ffmpeg not found: Install ffmpeg using your system's package manager
- resemble-enhance not found: Install using
pip install resemble-enhance - Permission denied: Make sure the script is executable with
chmod +x run.sh
The script provides detailed error messages for common issues:
- Missing source directory
- Failed audio conversion
- Enhancement process failures
- Output format conversion issues