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
Metadata
Release files for pyrnnoise 0.4.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pyrnnoise-0.4.5-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| pyrnnoise-0.4.5-py3-none-manylinux2014_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| pyrnnoise-0.4.5-py3-none-manylinux1_x86_64.whl | Python 3 | none | Linux glibc 2.5+ x86-64 | Details |
| pyrnnoise-0.4.5-py3-none-macosx_26_0_universal2.whl | Python 3 | none | macOS 26.0+ universal2 (ARM64, x86-64) | Details |
Total release size: 53.2 MB
Release files / pyrnnoise-0.4.5-py3-none-win_amd64.whl
| Download URL | pyrnnoise-0.4.5-py3-none-win_amd64.whl |
|---|---|
| Size | 13.3 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f46015e5a58212d2883bf8e5a2cafb3c6b115176d8039f8340132cb24866b7da
|
|
BLAKE2b-256 checksum How to use checksums |
208d0e19fbae841a4933c4ba783cf4466dfd24c70305fab9bc0c8674aa19ebc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / pyrnnoise-0.4.5-py3-none-manylinux2014_aarch64.whl
| Download URL | pyrnnoise-0.4.5-py3-none-manylinux2014_aarch64.whl |
|---|---|
| Size | 13.3 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
4b382d39b4963d38c8fe2f61639f634a5de0dd7dc731aca7ff1df48f9b1424cf
|
|
BLAKE2b-256 checksum How to use checksums |
d76996144ce909a371d9f0de8aceb18fb53188b8df14ef34fce909d345bafb42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / pyrnnoise-0.4.5-py3-none-manylinux1_x86_64.whl
| Download URL | pyrnnoise-0.4.5-py3-none-manylinux1_x86_64.whl |
|---|---|
| Size | 13.3 MB |
| Tags | Linux glibc 2.5+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
c095114532f9fa21f621084c879d72c93aaa0c9dbe38b662a63577bada2c214e
|
|
BLAKE2b-256 checksum How to use checksums |
f18b6498de7ef0a4670bbeae951bec9cfd2386e57ef386f53eec28e75be39790
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / pyrnnoise-0.4.5-py3-none-macosx_26_0_universal2.whl
| Download URL | pyrnnoise-0.4.5-py3-none-macosx_26_0_universal2.whl |
|---|---|
| Size | 13.4 MB |
| Tags | Python 3 macOS 26.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
8289b32664ac05d3246c1d8e95522f2bec7fd99b29f238a58745e9c2fad47dae
|
|
BLAKE2b-256 checksum How to use checksums |
29bbe19eb6a6c0706d955de366b72c4495369a79d52c839495a1d360e9ea1b91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|