Noise reduction in audio processing involves the removal or reduction of unwanted background noise or interference from an audio signal. You can achieve noise reduction in Python using various libraries and techniques.
The remove_background_noise is a Flask application that reduces noise from an input recording file and returns several reduced noise audio files (wav) from several noise reducing methods
-
Noisereduce is a noise reduction algorithm in python that reduces noise in a method called "spectral gating" which is a form of Noise Gate. It works by computing a spectrogram of a signal (and optionally a noise signal) and estimating a noise threshold (or gate) for each frequency band of that signal/noise. That threshold is used to compute a mask, which gates noise below the frequency-varying threshold.
-
In audio processing with the Librosa library in Python, you can reduce noise using spectral centroid-based thresholding. This calculates high and low spectral centroid thresholds, and then applies a noise reduction filter using the pysndfx library based on those thresholds. The result is a denoised version of the input audio, which is saved as a new WAV file.
-
To perform noise reduction using MFCC (Mel-frequency cepstral coefficients) in Python, you can use the python_speech_features library to extract MFCC features from the audio signal and then apply thresholding to reduce noise.
Sources:
Technologies used
- Backend: Python & Flask
- REST API documentation: Swagger UI
- Testing: Pytest
- CI: Github Actions
- Containerization: Docker
- File Storage: Cloudinary
To run this web application on your local machine, follow the steps below:
Before getting started, ensure that you have the following software installed on your machine:
- Python: Download and install Python from the official website: https://www.python.org/downloads/
- GIT: Download and install GIT from the official website: https://git-scm.com/downloads
Step-by-step guide on how to install the project and its dependencies.
- Clone the repository to your local machine using Git:
HTTPS
git clone https://github.com/bosukeme/remove_background_noise.gitSSH
git clone [email protected]:bosukeme/remove_background_noise.git- Navigate to the project directory
cd remove_background_noiceBefore you start the application, you need to set up an environment variables. Here's how you can do it:
CLOUD_NAME=
API_KEY=
API_SECRET=Create a file called .env file at the root folder of the project with the environmental variables above.
You can create your cloudinary key and secret by signing up on https://cloudinary.com/
- Install the project dependencies contained inside the requirements.txt file using PIP(Package Manager):
pip install -r requirements.txtOnce you have installed the dependencies, you can start the web application using
Linux, Windows "WSL" , MAC
gunicorn -c "gunicorn_config.py" "wsgi:app"Windows "CMD", "POWERSHELL"
python run.pyOnce you have installed the dependencies, and your flask app is running, you can run test within the directory
- run pytest
pytestnavigate to the root directory
docker-compose up --buildTo stop the containers
docker-compose stopAccess API documentation via Swagger UI using the link below after starting up the application
http://localhost:8001/api/v1.0/remove-noise/doc/-
Using the API: Refer to the Swagger API documentation at http://localhost:8001/api/v1.0/remove-noise/doc/ for a detailed list of available endpoints and how to interact with them.
-
Troubleshooting If you encounter any issues or have questions, please feel free to reach out to us by creating an issue on our GitHub repository: https://github.com/bosukeme/remove_background_noise.git.
This project is licensed under the MIT License.
Contributors names and contact info
Ukeme Wilson