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

Inference

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]]

Train

train unet1d unet1d-24khz /data_root/

Publish

publish model model_name /path/to/model

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.2.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

denoisers-0.2.0-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: denoisers-0.2.0.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for denoisers-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e147ab53854c9e3d468898a0de5585ddea864f38846a16564e683b9c71abce2a
MD5 494c6478fd8354ee84f9d783e1d23eca
BLAKE2b-256 9d2e58fef3c77092ade3e2b8333fb604f21378c1ebd6b6ff9281e0eb733ff42f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: denoisers-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for denoisers-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1be19a5f6bc77a630c42644823b62cf661ad05bbbc67e64895553f52f482e563
MD5 b8dee2a9b3e2f19791b4572728da8d33
BLAKE2b-256 bcfb057608def91e52de53555ffd68924795c63ac357ac2303e04b23a08d8827

See more details on using hashes here.

Supported by

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