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.
SCOREQ (Speech Contrastive Regression for Quality Assessment) is a neural, wav2vec2-based speech-quality metric. It predicts a MOS from a single signal (no-reference mode), or an embedding distance between a test and reference signal (reference mode).
Built on the audio_samples
ecosystem.
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, Scoreq
# 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")
# SCOREQ: no-reference MOS, or reference-based embedding distance.
model = Scoreq(domain="natural", mode="nr")
mos = model.predict("degraded.wav")
model = Scoreq(domain="natural", mode="ref")
distance = model.predict_ref("degraded.wav", "reference.wav")
Each signal may be an AudioSamples object or a path to a WAV/FLAC file
(decoded with audio_samples.read()), 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. Both metrics release the GIL while computing, so scoring
parallelises across Python threads.
Loading a Scoreq model is expensive (the first use of a given
(domain, mode) pair downloads ~378 MB of weights from Zenodo into
~/.cache/scoreq/), so construct one per (domain, mode) pair and reuse it
across calls.
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 anAudioSamplesnor a path.ValueError: invalidmode/domainstring.OSError: a file could not be read or decoded.audio_samples_qoe.VisqolError: the ViSQOL pipeline failed (most commonly a signal too short to extract a single analysis patch).audio_samples_qoe.ScoreqError: the SCOREQ pipeline failed, orpredict/predict_refwas called on a model loaded for the other mode.
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
Metadata
Release files for audio-samples-qoe 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| audio_samples_qoe-0.1.3.tar.gz | 391.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| audio_samples_qoe-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.17+ x86-64 | Details |
Total release size: 9.6 MB
Release files / audio_samples_qoe-0.1.3.tar.gz
| Download URL | audio_samples_qoe-0.1.3.tar.gz |
|---|---|
| Size | 391.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
479d275153450ee3b18d9a87f85b24c3253dac02b9e3170809cc8fec4b72dccd
|
|
BLAKE2b-256 checksum How to use checksums |
6fac1af8f8ff8aff922731131eda4923615f9fe5262477120a4218920aa00f91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.14.1
|
Release files / audio_samples_qoe-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | audio_samples_qoe-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 9.2 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
510eada42499e7beada4a0c0b918e18230c76a247ebfc4f4abe675c3314223a3
|
|
BLAKE2b-256 checksum How to use checksums |
4ea729d1309ddf26b06e30947f389193c2e50fda6b53bf660e45935e84aa92ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.14.1
|
Security for audio-samples-qoe 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.