PyRnNoise
Project description
pyrnnoise
Python bindings for RNNoise, a recurrent neural network for audio noise reduction.
Features
- Real-time noise suppression for speech audio
- Command-line interface for processing audio files
- Supports mono and stereo audio files
- Visualize voice activity detection probabilities
Installation
pip install pyrnnoise
Usage
Command-line interface
# Basic usage
denoise input.wav output.wav
# With voice activity detection plot
denoise input.wav output.wav --plot
Python API
from pyrnnoise import RNNoise
# Create denoiser instance
denoiser = RNNoise(sample_rate=48000)
# Process audio file
for speech_prob in denoiser.denoise_wav("input.wav", "output.wav"):
print(f"Processing frame with speech probability: {speech_prob}")
Advanced Usage
The RNNoise class provides several methods for processing audio at different levels:
-
denoise_frame(frame, partial=False): Process a single audio frame (480 samples at 48kHz)- Returns a tuple of (speech_probabilities, denoised_frame)
- speech_probabilities: Voice activity detection probabilities for each channel
- denoised_frame: The denoised audio frame
-
denoise_chunk(chunk, partial=False): Process a chunk of audio data- Takes a numpy array of audio samples [num_channels, num_samples]
- Yields tuples of (speech_probabilities, denoised_frame) for each frame
- Useful for processing audio streams or large audio files in chunks
Example using denoise_chunk:
import numpy as np
from pyrnnoise import RNNoise
# Create denoiser instance
denoiser = RNNoise(sample_rate=48000)
# Generate or load some audio data (stereo in this example)
audio_data = np.random.randint(-32768, 32767, (2, 48000), dtype=np.int16)
# Process audio chunk
for speech_prob, denoised_audio in denoiser.denoise_chunk(audio_data):
print(f"Speech probability: {speech_prob}")
# Process denoised_audio as needed
Build from source
# Clone with submodules
git submodule update --init
# Build RNNoise library
cmake -B pyrnnoise/build -DCMAKE_BUILD_TYPE=Release
cmake --build pyrnnoise/build --target install
# Install Python package in development mode
pip install -e .
License
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 Distributions
Built Distributions
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 pyrnnoise-0.4.3-py3-none-win_amd64.whl.
File metadata
- Download URL: pyrnnoise-0.4.3-py3-none-win_amd64.whl
- Upload date:
- Size: 13.3 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25e7d8d63f251238a439e6e3d54ad8cb147c9f2b7c7c56fc9d9a496f682d8b06
|
|
| MD5 |
6244cb7a4f18f358588a43d70bae5a0f
|
|
| BLAKE2b-256 |
cbe9795f8504fa7f07fc16e99e82413a6fe997df1999e18bb6fab0b428431a92
|
File details
Details for the file pyrnnoise-0.4.3-py3-none-manylinux2014_aarch64.whl.
File metadata
- Download URL: pyrnnoise-0.4.3-py3-none-manylinux2014_aarch64.whl
- Upload date:
- Size: 13.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
161c57e05257e0b51f1b21675dcb2debb8cc86903c1fe2ccc3feb4322e545732
|
|
| MD5 |
0fb59c8b8400353eb4502ff4ae7a5ab1
|
|
| BLAKE2b-256 |
aae49a13ede6521360341314bf90d5b687cd3f1bd4259bfea740dbc88340484a
|
File details
Details for the file pyrnnoise-0.4.3-py3-none-manylinux1_x86_64.whl.
File metadata
- Download URL: pyrnnoise-0.4.3-py3-none-manylinux1_x86_64.whl
- Upload date:
- Size: 13.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b094777e73797c5dd647782902c691ebb9a3c456c878e742597f5b55535a3db
|
|
| MD5 |
8881cede0da2e8aac07d3d610d69c755
|
|
| BLAKE2b-256 |
0451993a25a8b5220e23e0a31ff98747b8fce4685336e0fc4e8e156feab5c4f1
|
File details
Details for the file pyrnnoise-0.4.3-py3-none-macosx_15_0_universal2.whl.
File metadata
- Download URL: pyrnnoise-0.4.3-py3-none-macosx_15_0_universal2.whl
- Upload date:
- Size: 13.4 MB
- Tags: Python 3, macOS 15.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdd8e933d32457362e6f4e56831afa8155208825040ab075c4223baed755fa4f
|
|
| MD5 |
3397669d48afd49ba9c71b2902b96d8b
|
|
| BLAKE2b-256 |
1f9051bb94bcfd8aab186fd08902e0706a6eda5813485fb57eff011ce6ae4c51
|