Metadata-Version: 2.4
Name: whisqa
Version: 0.1.0
Summary: Whisper-based non-intrusive speech quality assessment
Project-URL: Homepage, https://github.com/leto19/WhiSQA
Project-URL: Repository, https://github.com/leto19/WhiSQA
Author-email: George Close <g.close@sheffield.ac.uk>
License: MIT License
        
        Copyright (c)  2026 George Close
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Keywords: MOS,assessment,audio,quality,speech,whisper
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Requires-Dist: numpy>=1.24
Requires-Dist: soundfile>=0.12
Requires-Dist: torch>=2.0
Requires-Dist: torchaudio>=2.0
Requires-Dist: transformers>=4.35
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-mock; extra == 'dev'
Description-Content-Type: text/markdown

# WhiSQA: Non-Intrusive Speech Quality Prediction Using Whisper Encoder Features

[![arXiv](https://img.shields.io/badge/arXiv-2508.02210-b31b1b.svg)](https://arxiv.org/abs/2508.02210)

WhiSQA uses the frozen encoder of OpenAI's Whisper-small model as a feature extractor, adds a lightweight trainable transformer head, and predicts ITU-T P.835 speech quality dimensions without requiring a clean reference signal.

## Install

```bash
pip install whisqa
```

## Usage

```python
import whisqa

# Single MOS score
whisqa.predict("speech.wav")
# → {'mos': 3.82}

# Full P.835 dimensions
whisqa.predict("speech.wav", model_type="multi")
# → {'mos': 3.82, 'noisiness': 4.10, 'coloration': 3.55, 'discontinuity': 4.20, 'loudness': 3.90}

# Efficient repeated inference
model = whisqa.load_model("single")
for f in my_files:
    print(whisqa.predict(f, model=model))
```

```bash
# CLI
whisqa speech.wav
whisqa speech.wav --model multi
```

Input must be mono WAV. Any sample rate is accepted; audio is resampled to 16 kHz automatically.

> **First-run note:** `load_model()` downloads `openai/whisper-small` (~240 MB) from HuggingFace Hub and caches it in `~/.cache/huggingface/`. The WhiSQA head weights ship inside the package and require no download.

## Results

![Results](results.png)

## Citation

If you use WhiSQA in your work, please cite:

```bibtex
@inproceedings{close2025whisqa,
  title     = {{WhiSQA}: Non-Intrusive Speech Quality Prediction Using {Whisper} Encoder Features},
  author    = {Close, George and Hong, Kris Y. and Hain, Thomas and Goetze, Stefan},
  booktitle = {Speech and Computer -- 27th International Conference, {SPECOM} 2025,
               Szeged, Hungary, October 13--15, 2025, Proceedings, Part {I}},
  editor    = {Karpov, Alexey and Gosztolya, G{\'a}bor},
  series    = {Lecture Notes in Computer Science},
  volume    = {16187},
  pages     = {39--51},
  publisher = {Springer},
  year      = {2025},
  doi       = {10.1007/978-3-032-07956-5_3},
}
```
