A production-grade Python audio enhancement toolkit
Project description
AudioEnhancer
A production-grade Python audio enhancement toolkit.
Features
- Noise Removal: Spectral gating, impulse noise removal, and more.
- Audio Normalization: Peak, RMS, and LUFS (EBU R128).
- Format Conversion: Convert between various audio formats like WAV, MP3, FLAC, etc.
- Advanced Architecture: Built with OOP and common software design patterns.
Prerequisites
This project requires FFmpeg to be installed and available in your system's PATH.
Installation
-
Clone the repository:
git clone https://github.com/CodeWithBotinaOficial/audio_enhancer.git cd audio_enhancer
-
Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` pip install -r requirements.txt
Usage
Command-Line Interface (CLI)
The CLI provides a quick way to process audio files. You can run it as a module or after installing the package:
python -m audio_enhancer process-file examples/sample_audio/input.wav examples/output/output.mp3 --noise-profile spectral_gate --normalize lufs --lufs -16.0
Library Usage
The project can be used as a Python library by importing the AudioEnhancer facade.
from audio_enhancer import AudioEnhancer
from audio_enhancer.normalization.lufs import LufsNormalizer
from audio_enhancer.noise_reduction.spectral_gating import SpectralGatingNoiseReducer
def main():
# Create an enhancer instance
enhancer = AudioEnhancer.get_instance()
# Load an audio file
audio = enhancer.load_audio("examples/sample_audio/input.wav")
# Create a processing pipeline
pipeline = (
enhancer.get_builder()
.add_step(SpectralGatingNoiseReducer())
.add_step(LufsNormalizer(-16.0))
.build()
)
# Apply the pipeline
enhanced_audio = pipeline.process(audio)
# Export the result
enhancer.export_audio(enhanced_audio, "examples/output/enhanced_audio.flac", "flac")
print("Audio enhancement complete.")
if __name__ == "__main__":
main()
Design Patterns
This project serves as a practical example of various software design patterns:
- Facade:
AudioEnhancerclass provides a simple, high-level interface. - Strategy: Different normalization and noise reduction algorithms are implemented as strategies.
- Builder:
PipelineBuilderconstructs complex processing pipelines step-by-step. - Singleton: The
LoggerandAudioEnhanceruse the Singleton pattern. - Factory Method: Used to create different audio processors.
- ... and many more. See the
audio_enhancer/patterns/directory for detailed examples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file audioenhancer-0.0.1.tar.gz.
File metadata
- Download URL: audioenhancer-0.0.1.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49d96735cc4df4d421d973501285a0324bbb8de7aa3320c7ad2d030ec6b30408
|
|
| MD5 |
6a5503bcc4def41c12f2e8ce640b7103
|
|
| BLAKE2b-256 |
29e5a67a6edc34b39c1190c480e919a7dbc3c9feed063e584f1a39fffac675da
|
File details
Details for the file audioenhancer-0.0.1-py3-none-any.whl.
File metadata
- Download URL: audioenhancer-0.0.1-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01a45d9cdd19fcdd4f42bb18403b05db58ca9b6e31e37456e5652d37e278aa03
|
|
| MD5 |
d8942279ebf455a0b64171609e3b283c
|
|
| BLAKE2b-256 |
057dcf785910879df02bdbf8eaad1f19ce6b0cd667310d7a8bf94ff6a4e44c24
|