Skip to main content

Pure-ONNX multi-engine audio super-resolution / bandwidth extension (upscale speech to 48 kHz)

Project description

audiosronnx

Pure-ONNX, multi-engine audio super-resolution / bandwidth extension. Upscale low-sample-rate or low-bandwidth speech — 8 kHz telephony, muffled recordings, low-fidelity TTS — to a clean 48 kHz signal. Inference runs entirely on onnxruntime; there is no torch at runtime.

audiosronnx is the super-resolution sibling of the TigreGotico pure-ONNX speech libraries (vadonnx, voiceclonnx, speakeronnx) and mirrors their conventions: a single load_sr(engine=...) entry point, an engine registry, a HuggingFace-backed model resolver with an XDG cache, and a small CLI.

Install

pip install audiosronnx

Runtime dependencies: numpy, onnxruntime, scipy, soundfile, huggingface_hub. ONNX models are downloaded on first use from the Hugging Face Hub and cached under ~/.local/share/audiosronnx.

Engines

Engine Input SR Output SR Size CPU speed License Status
lavasr (default) 8–48 kHz 48 kHz ~52 MB ~50× realtime Apache-2.0 shipped
novasr 16 kHz 48 kHz ~52 KB ~1000× realtime Apache-2.0 shipped
  • lavasr — a Vocos-based bandwidth-extension model with a Linkwitz-Riley spectral merge that preserves the original low band, plus an optional UL-UNAS denoiser. It accepts any input rate from 8 to 48 kHz and is the best-quality engine. All spectral DSP (STFT, ISTFT, mel filterbank, resampling, merge) runs in numpy/scipy, so no torch.stft ever enters an ONNX graph.
  • novasr — a tiny conv1d / BigVGAN-snake generator that upsamples 16 kHz to 48 kHz in a single time-domain pass. Extremely fast and memory-light, at lower fidelity than lavasr; useful for on-device enhancement and quick dataset restoration.

Both engines are derived from the LavaSR/NovaSR projects by Yatharth Sharma (LavaSR, NovaSR), Apache-2.0.

Quickstart

from audiosronnx import load_sr

sr = load_sr("lavasr")                      # default engine

# low-level primitive: numpy array or path in, (float32 mono, 48000) out
out, rate = sr.upscale("telephone_8k.wav")  # -> (np.ndarray float32, 48000)

# array input (you supply the sample rate)
import soundfile as sf
audio, in_sr = sf.read("input.wav")
out, rate = sr.upscale(audio, in_sr)

# file / directory helpers
sr.upscale_file("in.wav", "out_48k.wav")
sr.upscale_dir("clips_in/", "clips_out_48k/")

# the fast tiny engine instead
fast = load_sr("novasr")
fast.upscale_file("in_16k.wav", "out_48k.wav")

LavaSR options:

sr = load_sr("lavasr", denoise=True, cutoff_hz=6000)

CLI

audiosronnx list                              # list engines
audiosronnx probe input.wav                   # print format / duration
audiosronnx upscale in.wav out.wav            # default engine (lavasr)
audiosronnx upscale in.wav out.wav --engine novasr
audiosronnx upscale in.wav out.wav --denoise  # lavasr denoiser stage
audiosronnx upscale-dir clips_in/ clips_out/

API

  • load_sr(engine="lavasr", *, providers=None, cache_dir=None, revision=None, **kwargs) -> SRModel
  • SRModel.upscale(audio, sample_rate=None) -> (np.ndarray float32 mono, 48000)audio is a path, raw int16 PCM bytes, or a numpy array. The low-level primitive.
  • SRModel.upscale_file(in_path, out_path) -> str
  • SRModel.upscale_dir(in_dir, out_dir) -> list[str]
  • available_models(), get_engine(alias), register_engine(entry), ENGINE_REGISTRY

Custom / third-party engines

Subclass SRModel, implement _upscale_array(audio, sample_rate) -> np.ndarray (a 48 kHz mono float32 array), and register an EngineEntry:

from audiosronnx import SRModel, EngineEntry, register_engine

class MySR(SRModel):
    output_sample_rate = 48000
    def _upscale_array(self, audio, sample_rate):
        ...  # run your ONNX session, return a 48 kHz float32 array

register_engine(EngineEntry(alias="mysr", adapter_class=MySR, license="MIT"))

Model hosting

Exported ONNX weights are hosted on the Hugging Face Hub and pinned by revision:

  • TigreGotico/audiosronnx-lavasrbackbone.onnx, spec_head.onnx, denoiser_core.onnx
  • TigreGotico/audiosronnx-novasrnovasr.onnx

The export scripts under conversion/ reproduce these from the upstream PyTorch checkpoints and validate each ONNX graph against its PyTorch submodule (max absolute error).

Evaluated but not shipped

The audio super-resolution landscape was surveyed for other models to export. These were evaluated and are not shipped, for the reasons given:

Model License Reason not shipped
AP-BWE MIT Permissive and ONNX-friendly (convolutional amplitude/phase predictor; STFT stays outside the graph). A strong candidate not yet packaged here.
HiFi-GAN-BWE MIT Permissive, time-domain, ships its own export script. A strong candidate not yet packaged here.
FLowHigh MIT Single-step flow matching, but depends on an external BigVGAN vocoder plus a mel/STFT front-end — a multi-component export rather than one clean graph.
AudioSR MIT ~6 GB latent-diffusion model (VAE + LDM + vocoder, iterative sampler, ~0.6× realtime on GPU). Not CPU-runnable at usable latency; impractical to export.
NU-Wave2 none Diffusion (iterative sampler) and the repository ships no license file.
mdctGAN unclear (NOASSERTION) Unclear license, and its MDCT front-end relies on torch.fft, which exports to ONNX unreliably.
VoiceFixer / NVSR MIT Speech restoration rather than pure bandwidth extension; two-stage mel-predictor + neural vocoder, heavier and less focused than the shipped engines.

An engine is only shipped when it exports cleanly to ONNX, runs on CPU via onnxruntime, carries a permissive license, and produces verified 48 kHz output.

License

Apache-2.0. The shipped model weights are Apache-2.0 (LavaSR, NovaSR).

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

audiosronnx-0.0.1.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

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

audiosronnx-0.0.1-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file audiosronnx-0.0.1.tar.gz.

File metadata

  • Download URL: audiosronnx-0.0.1.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for audiosronnx-0.0.1.tar.gz
Algorithm Hash digest
SHA256 71e82f1ed3e429f4207ba41d80a8209e0d1f52f21695367d7be918cda088eed1
MD5 0568444ab25ac355e3f717f883d5f5fc
BLAKE2b-256 142bb46fb250d85fc33eb82d6f5035cfdd71529216e862f9d549240518971684

See more details on using hashes here.

File details

Details for the file audiosronnx-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: audiosronnx-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for audiosronnx-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa16225903981b9f78c870f763fc25c8d589bdb18757ef5790bb0415d877e6ea
MD5 24e06571e01e413b4279beb663857e66
BLAKE2b-256 2045e2da82272eb62039e68aca8fb1323c44b315af9ea2e6f3268274bd28025a

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