Single-channel speech restoration in Python — denoising, dereverberation, declipping and packet-loss concealment, with objective evaluation. The numeric core is plain NumPy, so it runs anywhere and offline; a PyTorch backend is optional for heavier workloads.
Real recordings are rarely clean. A voice message arrives with fan noise, a
lecture is smeared by a reverberant room, a loud passage clips, and a VoIP
call drops packets. revoice collects the classic, well-understood DSP
methods for each of these problems behind one small, typed API, together
with the simulators and metrics you need to measure whether a method
actually helped.
It is deliberately dependency-light and reproducible: no pretrained models to download, no service to call, no hidden randomness.
pip install revoice # NumPy core only
pip install "revoice[torch]" # add the optional PyTorch backendPython 3.10+ is required.
import numpy as np
from revoice import denoise, evaluate
from revoice.simulate import add_noise
# A clean signal you already have (here, a synthetic stand-in).
t = np.arange(2 * 16000) / 16000
clean = 0.3 * np.sin(2 * np.pi * 220 * t)
noisy = add_noise(clean, snr_db=5.0)
restored = denoise(noisy, method="wiener")
print(evaluate(clean, restored, sample_rate=16000))
# {'snr': ..., 'segmental_snr': ..., 'lsd': ..., 'stoi': ..., 'pesq': ...}| Task | Function | Method |
|---|---|---|
| Denoising | revoice.denoise |
spectral subtraction / Wiener gains |
| Dereverberation | revoice.dereverb |
spectral late-reverb suppression |
| Declipping | revoice.declip |
clipped-region cubic reconstruction |
| Packet-loss concealment | revoice.conceal |
waveform-similarity extrapolation |
| Evaluation | revoice.evaluate |
SNR, segmental SNR, LSD, STOI, PESQ proxies |
The revoice.simulate module produces controlled degradations (noise at a
target SNR, synthetic reverberation, hard clipping, random packet loss) so
you can build reproducible test sets.
revoice denoise noisy.wav clean.wav --method wiener
revoice dereverb wet.wav dry.wav
revoice declip clipped.wav fixed.wav
revoice evaluate reference.wav processed.wavThe stoi and pesq functions are compact, dependency-free proxies that
follow the shape of the standard measures. They track quality ordering well
and are ideal for regression tests and relative comparison, but they are not
calibrated replacements for ITU-T P.862 (PESQ) or the reference STOI.
MIT — see LICENSE.