Skip to main content

Computes Short Term Objective Intelligibility measure

Project description

Python implementation of STOI

Implementation of the classical and extended Short Term Objective Intelligibility measures

Intelligibility measure which is highly correlated with the intelligibility of degraded speech signals, e.g., due to additive noise, single/multi-channel noise reduction, binary masking and vocoded speech as in CI simulations. The STOI-measure is intrusive, i.e., a function of the clean and degraded speech signals. STOI may be a good alternative to the speech intelligibility index (SII) or the speech transmission index (STI), when you are interested in the effect of nonlinear processing to noisy speech, e.g., noise reduction, binary masking algorithms, on speech intelligibility.
Description taken from Cees Taal's website

Install

pip install pystoi or pip3 install pystoi

Usage

import soundfile as sf
from pystoi import stoi

clean, fs = sf.read('path/to/clean/audio')
denoised, fs = sf.read('path/to/denoised/audio')

# Clean and den should have the same length, and be 1D
d = stoi(clean, denoised, fs, extended=False)

Running the Octave tests

sudo apt update 
sudo apt install octave octave-signal 
pip install oct2py
python -m pytest tests/test_python_octave.py
python -m pytest tests/test_stoi_octave.py

Matlab code & Testing

All the Matlab code in this repo is taken from or adapted from the code available here (STOI – Short-Time Objective Intelligibility Measure – ) written by Cees Taal.

Thanks to Cees Taal who open-sourced his Matlab implementation and enabled thorough testing of this python code.

If you want to run the tests, you will need Matlab, matlab.engine (install instructions here) and matlab_wrapper (install with pip install matlab_wrapper). The tests can only be ran under Python 2.7 as matlab.engine and matlab_wrapper are only compatible with Python2.7 Tests are passing at relative and absolute tolerance of 1e-3, which is enough for the considered application (all the variability is coming from the resampling method when signals are not natively sampled at 10kHz).

Very big thanks to @gauss256 who translated all the matlab scripts to Octave, and wrote all the tests for it!

Contribute

Any contribution are welcome~, specially to improve the execution speed of the code~ (thank you Przemek Pobrotyn for a 4x speed-up!) :

  • Improve the resampling method to match Matlab's resampling in tests/. This can be considered a solved issue thanks to @gauss256 !
  • Write tests for Python 3 (with transplant for example)

References

  • [1] C.H.Taal, R.C.Hendriks, R.Heusdens, J.Jensen 'A Short-Time Objective Intelligibility Measure for Time-Frequency Weighted Noisy Speech', ICASSP 2010, Texas, Dallas.
  • [2] C.H.Taal, R.C.Hendriks, R.Heusdens, J.Jensen 'An Algorithm for Intelligibility Prediction of Time-Frequency Weighted Noisy Speech', IEEE Transactions on Audio, Speech, and Language Processing, 2011.
  • [3] J. Jensen and C. H. Taal, 'An Algorithm for Predicting the Intelligibility of Speech Masked by Modulated Noise Maskers', IEEE Transactions on Audio, Speech and Language Processing, 2016.

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

pystoi-0.4.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

pystoi-0.4.1-py2.py3-none-any.whl (8.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pystoi-0.4.1.tar.gz.

File metadata

  • Download URL: pystoi-0.4.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

File hashes

Hashes for pystoi-0.4.1.tar.gz
Algorithm Hash digest
SHA256 1c6f50d6fbfee46b00c922458cdbd27228d9830ca81cea788fd600fc2f7de6e4
MD5 45f99690e773a21591ab45e582190241
BLAKE2b-256 bf3d1ae8bdb686c6aaaeef474aa6b790abbe38f42b61188b57a974dd9320e521

See more details on using hashes here.

File details

Details for the file pystoi-0.4.1-py2.py3-none-any.whl.

File metadata

  • Download URL: pystoi-0.4.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

File hashes

Hashes for pystoi-0.4.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e277b671663d26d35a2416c9c8010a74084e6c3970354506398051a554896939
MD5 1b69fa3d3575c5cd8c44bfe6c821614c
BLAKE2b-256 1a2260cd92bd3ec00948800984410f4cf5ded5bd8e9b715729f3642efe0edb3d

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