cgp
A Python implementation of the correlation based glimpse proportion (CGP) index proposed in [1] for speech intelligibility prediction.
Supports batched inputs.
Installation
pip install python-cgp
Usage
import cgp
import soundfile as sf
x, fs = sf.read("path/to/input/signal")
y, fs = sf.read("path/to/reference/signal")
z = cgp.cgp(x, y, fs)
For batched inputs:
import cgp
import numpy as np
import soundfile as sf
x_1, fs = sf.read("path/to/input/signal/1")
y_1, fs = sf.read("path/to/reference/signal/1")
x_2, fs = sf.read("path/to/input/signal/2")
y_2, fs = sf.read("path/to/reference/signal/2")
# x_1 and x_2 might have different lengths so we pad before creating the batch
lengths = [len(x_1), len(x_2)]
n = max(lengths)
x_1 = np.pad(x_1, (0, n - len(x_1)))
y_1 = np.pad(y_1, (0, n - len(y_1)))
x_2 = np.pad(x_2, (0, n - len(x_2)))
y_2 = np.pad(y_2, (0, n - len(y_2)))
# create the batch
x = np.stack([x_1, x_2])
y = np.stack([y_1, y_2])
# provide the lengths argument to ensure the same result as for unbatched processing
z = cgp.cgp(x, y, fs, axis=1, lengths=lengths)
Note
This implementation corrects an indexing error in the original MATLAB code in removeSilentFrames.m which causes the last frame in the voice activity detection stage to be discarded.
This means the results can differ slightly from the original implementation.
To obtain the same results as the original implementation, set the _discard_last_frame argument to True.
Speed comparison with pystoi
The paper claims CGP takes substantially less time to execute compared to baselines such as ESTOI [2].
Below is a comparison with pystoi for unbatched inputs.
TODO
References
[1] A. Alghamdi, L. Moen, W.-Y. Chan, D. Fogerty and J. Jensen, "Correlation based glimpse proportion index", in Proc. WASPAA, 2023.
[2] J. Jensen and C. H. Taal, "An algorithm for predicting the intelligibility of speech masked by modulated noise maskers", in IEEE/ACM Trans. Audio, Speech, Lang. Process., 2016.
Metadata
Release files for python-cgp 0.0.1
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 | |
|---|---|---|---|---|
| python-cgp-0.0.1.tar.gz | 9.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_cgp-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.0 kB
Release files / python-cgp-0.0.1.tar.gz
| Download URL | python-cgp-0.0.1.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53396c47c242dfe5f6c2fa2175c2ace3e52bd33de41b1aaa44ac1ec042a5059e
|
|
BLAKE2b-256 checksum How to use checksums |
6c7383193abc13119f57bd52920703f3ae723a67b5d8f01f3ce98bd10e8a2686
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.18
|
Release files / python_cgp-0.0.1-py3-none-any.whl
| Download URL | python_cgp-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
024abd23a36d368656a8f2905be25cddc8ab419b73ea9d18f281371a408bc9e4
|
|
BLAKE2b-256 checksum How to use checksums |
2038c46329d297ce5e78d11174a12661e146e063436dc19044e03442ce8e18cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.18
|
Security for python-cgp 0.0.1
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.