Skip to main content

A package for training audio denoisers

Project description

Denoisers

Denoisers is a denoising library for audio with a focus on simplicity and ease of use. There are two major architectures available for waveforms: WaveUNet which follows the paper and a custom UNet1D architecture similar to what you would see in diffusion models.

Demo

Hugging Face Spaces

Usage/Examples

pip install denoisers
import torch
import torchaudio
from denoisers import WaveUNetModel
from tqdm import tqdm

model = WaveUNetModel.from_pretrained("wrice/waveunet-vctk-24khz")

audio, sr = torchaudio.load("noisy_audio.wav")

if sr != model.config.sample_rate:
    audio = torchaudio.functional.resample(audio, sr, model.config.sample_rate)

if audio.size(0) > 1:
    audio = audio.mean(0, keepdim=True)

chunk_size = model.config.max_length

padding = abs(audio.size(-1) % chunk_size - chunk_size)
padded = torch.nn.functional.pad(audio, (0, padding))

clean = []
for i in tqdm(range(0, padded.shape[-1], chunk_size)):
    audio_chunk = padded[:, i:i + chunk_size]
    with torch.no_grad():
        clean_chunk = model(audio_chunk[None]).audio
    clean.append(clean_chunk.squeeze(0))

denoised = torch.concat(clean, 1)[:, :audio.shape[-1]]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

denoisers-0.1.8.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

denoisers-0.1.8-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file denoisers-0.1.8.tar.gz.

File metadata

  • Download URL: denoisers-0.1.8.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for denoisers-0.1.8.tar.gz
Algorithm Hash digest
SHA256 e7451f1c8d01629eab7b12d1968baf06adcc7774d8af6de55b801e6368b07fa8
MD5 7bccc87c7bd80f8c1fb88f6992978172
BLAKE2b-256 a9bbad931e1961f5cee80eb82c31bcd7f0000af114e87b1b5d3d8977a43dd795

See more details on using hashes here.

File details

Details for the file denoisers-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: denoisers-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for denoisers-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 51986082fe9b03d36c85430f08aa1a2a32c91bd645d02baf4101830a718127c3
MD5 f5cae4a71814870625413d5c53910d2f
BLAKE2b-256 7bb17e62abb9df3684a9c5c022eaacfaa31bb071774e48f3582af19c3c6610a5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page