Perceptual audio quality metrics (ViSQOL MOS-LQO) — pure-Rust implementation with Python bindings
Project description
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 anAudioSamplesnor a path.ValueError: invalidmodestring.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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file audio_samples_qoe-0.1.2.tar.gz.
File metadata
- Download URL: audio_samples_qoe-0.1.2.tar.gz
- Upload date:
- Size: 103.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2be05608f467708933e4214e9a2d0832ea960622a9f7b65739e433fa74e85aea
|
|
| MD5 |
751846c9651bea0f97ecdff5d20bdfda
|
|
| BLAKE2b-256 |
300c522d7f5f2fcf144c9d40308b74fcf9cfecd0289524b7caf437a27a1d3a3c
|
File details
Details for the file audio_samples_qoe-0.1.2-cp310-abi3-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: audio_samples_qoe-0.1.2-cp310-abi3-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10+, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7b2e69251d9140474e160ad14a7158bb0bc09b7aafddc6130eb9e90e93a9480
|
|
| MD5 |
97fe4b3676f80d8c27c9d327a394e5fd
|
|
| BLAKE2b-256 |
fec9d88d81cc23ecce5a6a2aa43820119f1647f9cb35227661f8d9f517670846
|