Skip to main content

Perceptual audio quality metrics (ViSQOL MOS-LQO) — pure-Rust implementation with Python bindings

Project description

# audio-samples-qoe

PyPI Python Docs License: MIT

Perceptual audio quality metrics in pure Rust, with Python bindings.

ViSQOL (Virtual Speech Quality Objective Listener) is a full-reference metric that compares a degraded signal against a clean reference and predicts a MOS-LQO in the range 1.0 to 5.0. Audio and speech modes, conformance-tested against the reference implementation.

Built on the audio_samples ecosystem.

The crate also ships SCOREQ, a neural speech-quality metric. It is not yet exposed in the Python bindings.

Install

pip install audio-samples-qoe

The wheel is self-contained, so no Rust toolchain is needed. To build from source instead, install maturin and run maturin develop --release from the repository root.

Usage

from audio_samples import AudioSamples
from audio_samples_qoe import visqol

# Files or audio_samples.AudioSamples, in any combination.
score = visqol("reference.wav", "degraded.wav")

# Speech mode is a keyword away.
score = visqol("reference.wav", "degraded.wav", mode="speech")

Each signal may be an AudioSamples object or a path to a WAV/FLAC file (decoded by the native Rust reader), in any combination. Raw arrays are deliberately not accepted: wrap them with AudioSamples.new_mono(arr, sample_rate) / new_multi, which is where the sample rate is attached. Multi-channel signals are mixed down to mono, and any input sample rate is handled internally. visqol releases the GIL while computing, so scoring parallelises across Python threads.

Modes

Mode Operating rate Bands MOS mapping Patch selection
"audio" 48 kHz (resampled) 32, up to Nyquist Support vector regression All patches
"speech" Reference's native rate 21, ≤ 8 kHz Exponential NSIM fit Voice-activity gated

In speech mode the reference is never resampled (16 kHz input is recommended), silence in the reference is excluded by a voice-activity detector, and identical signals score 5.0.

Errors

  • TypeError: an argument is neither an AudioSamples nor a path.
  • ValueError: invalid mode string.
  • OSError: a file could not be read or decoded.
  • audio_samples_qoe.VisqolError: the metric pipeline failed (most commonly a signal too short to extract a single analysis patch).

The package ships full type stubs and a py.typed marker, so mypy, pyright, and IDE completion work out of the box.

Changelog

See CHANGELOG.md.

Contributing

See CONTRIBUTING.md.

License

MIT

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

audio_samples_qoe-0.1.1.tar.gz (103.8 kB view details)

Uploaded Source

Built Distribution

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

audio_samples_qoe-0.1.1-cp310-abi3-manylinux_2_35_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.35+ x86-64

File details

Details for the file audio_samples_qoe-0.1.1.tar.gz.

File metadata

  • Download URL: audio_samples_qoe-0.1.1.tar.gz
  • Upload date:
  • Size: 103.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for audio_samples_qoe-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6ed02ed18e2cefe76291ebb1ae481a06839442ebb729bc334aa2af41053bc773
MD5 bd969bbc98e03989e5240a3906f9c204
BLAKE2b-256 45c8dfba0338309c638e7500cc5f71a3e91d9facb8cb5f66ffb199ef9e92db0c

See more details on using hashes here.

File details

Details for the file audio_samples_qoe-0.1.1-cp310-abi3-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for audio_samples_qoe-0.1.1-cp310-abi3-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 6fbf940a162dfd757f5be7dce424851b23aef8add9ba799ba585cf6650d19118
MD5 ffbc9007096e5547ae053f905a7fda04
BLAKE2b-256 febcb13b73d6dbd3e5c6cf45ade2a5a746ee7aada19ef2e349678f02e8233bd0

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