{"id":32174881,"url":"https://github.com/ludlows/pesq","last_synced_at":"2026-02-19T07:03:00.034Z","repository":{"id":36471739,"uuid":"185869802","full_name":"ludlows/PESQ","owner":"ludlows","description":"PESQ (Perceptual Evaluation of Speech Quality) Wrapper for Python Users (narrow band and wide band)","archived":false,"fork":false,"pushed_at":"2024-09-05T02:45:00.000Z","size":306,"stargazers_count":618,"open_issues_count":5,"forks_count":104,"subscribers_count":12,"default_branch":"master","last_synced_at":"2026-01-14T07:35:36.509Z","etag":null,"topics":["audio-processing","pesq","python","signal-processing"],"latest_commit_sha":null,"homepage":"https://github.com/ludlows/PESQ","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ludlows.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-05-09T20:51:03.000Z","updated_at":"2026-01-06T16:21:40.000Z","dependencies_parsed_at":"2022-07-11T09:52:14.435Z","dependency_job_id":"8793dcfc-5daf-40bd-9d00-0760bcc03329","html_url":"https://github.com/ludlows/PESQ","commit_stats":{"total_commits":65,"total_committers":6,"mean_commits":"10.833333333333334","dds":"0.49230769230769234","last_synced_commit":"5e230c59a3272fa80d8a6ea0d1e623f3fa560731"},"previous_names":["ludlows/python-pesq"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ludlows/PESQ","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludlows%2FPESQ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludlows%2FPESQ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludlows%2FPESQ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludlows%2FPESQ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ludlows","download_url":"https://codeload.github.com/ludlows/PESQ/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludlows%2FPESQ/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29605806,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio-processing","pesq","python","signal-processing"],"created_at":"2025-10-21T19:13:06.030Z","updated_at":"2026-02-19T07:03:00.029Z","avatar_url":"https://github.com/ludlows.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pesq\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6549559.svg)](https://doi.org/10.5281/zenodo.6549559)\n[![Downloads](https://pepy.tech/badge/pesq)](https://pepy.tech/project/pesq)\n[![Downloads](https://pepy.tech/badge/pesq/month)](https://pepy.tech/project/pesq)\n\nPESQ (Perceptual Evaluation of Speech Quality) Wrapper for Python Users\n\nThis code is designed for numpy array specially.\n\n# Requirements\n\n    C compiler\n    numpy\n    cython\n\n\n# Install with pip\n\n```bash\n# PyPi Repository\n$ pip install pesq\n\n# The Latest Version\n$ pip install https://github.com/ludlows/python-pesq/archive/master.zip\n```\n\n# Usage for narrowband and wideband Modes\n\nPlease note that the sampling rate (frequency) should be 16000 or 8000 (Hz). \n\nAnd using 8000Hz is supported for narrowband only.\n\nThe code supports error-handling behaviors now.\n\n```python\ndef pesq(fs, ref, deg, mode='wb', on_error=PesqError.RAISE_EXCEPTION):\n    \"\"\"\n    Args:\n        ref: numpy 1D array, reference audio signal \n        deg: numpy 1D array, degraded audio signal\n        fs:  integer, sampling rate\n        mode: 'wb' (wide-band) or 'nb' (narrow-band)\n        on_error: error-handling behavior, it could be PesqError.RETURN_VALUES or PesqError.RAISE_EXCEPTION by default\n    Returns:\n        pesq_score: float, P.862.2 Prediction (MOS-LQO)\n    \"\"\"\n```\nOnce you select `PesqError.RETURN_VALUES`, the `pesq` function will return -1 when an error occurs.\n\nOnce you select `PesqError.RAISE_EXCEPTION`, the `pesq` function will raise an exception when an error occurs.\n\nIt supports the following errors now: `InvalidSampleRateError`, `OutOfMemoryError`,`BufferTooShortError`,`NoUtterancesError`,`PesqError`(other unknown errors).\n\n```python\nfrom scipy.io import wavfile\nfrom pesq import pesq\n\nrate, ref = wavfile.read(\"./audio/speech.wav\")\nrate, deg = wavfile.read(\"./audio/speech_bab_0dB.wav\")\n\nprint(pesq(rate, ref, deg, 'wb'))\nprint(pesq(rate, ref, deg, 'nb'))\n```\n\n# Usage for `multiprocessing` feature\n\n```python\ndef pesq_batch(fs, ref, deg, mode='wb', n_processor=None, on_error=PesqError.RAISE_EXCEPTION):\n    \"\"\"\n   Running `pesq` using multiple processors\n    Args:\n        on_error:\n        ref: numpy 1D (n_sample,) or 2D array (n_file, n_sample), reference audio signal\n        deg: numpy 1D (n_sample,) or 2D array (n_file, n_sample), degraded audio signal\n        fs:  integer, sampling rate\n        mode: 'wb' (wide-band) or 'nb' (narrow-band)\n        n_processor: cpu_count() (default) or number of processors (chosen by the user) or 0 (without multiprocessing)\n        on_error: PesqError.RAISE_EXCEPTION (default) or PesqError.RETURN_VALUES\n    Returns:\n        pesq_score: list of pesq scores, P.862.2 Prediction (MOS-LQO)\n    \"\"\"\n```\nthis function uses `multiprocessing` features to boost time efficiency.\n\nWhen the `ref` is an 1-D numpy array and `deg` is a 2-D numpy array, the result of `pesq_batch` is identical to the value of `[pesq(fs, ref, deg[i,:],**kwargs) for i in range(deg.shape[0])]`.\n\nWhen the `ref` is a 2-D numpy array and `deg` is a 2-D numpy array, the result of `pesq_batch` is identical to the value of `[pesq(fs, ref[i,:], deg[i,:],**kwargs) for i in range(deg.shape[0])]`.\n\n\n# Correctness\n\nThe correctness is verified by running samples in audio folder.\n\nPESQ computed by this code in wideband mode is    1.0832337141036987\n\nPESQ computed by this code in narrowband mode is  1.6072081327438354\n\n# Note\n\nSampling rate (fs|rate) - No default. Must select either 8000Hz or 16000Hz.\n \nNote there is narrowband (nb) mode only when sampling rate is 8000Hz.\n\nThe original C source code is modified. \n\n# Who is using `pesq`\n\nPlease click [here](https://github.com/ludlows/python-pesq/network/dependents) to see these repositories, whose owners include `Facebook Research`, `SpeechBrain`, `NVIDIA` .etc.\n\n# Cite this code\n\n```\n   @software{miao_wang_2022_6549559,\n   author       = {Miao Wang, Christoph Boeddeker, Rafael G. Dantas and ananda seelan},\n   title        = {PESQ (Perceptual Evaluation of Speech Quality) Wrapper for Python Users},\n   month        = may,\n   year         = 2022,\n   publisher    = {Zenodo},\n   version      = {v0.0.4},\n   doi          = {10.5281/zenodo.6549559},\n   url          = {https://doi.org/10.5281/zenodo.6549559}}\n```\n\n# Acknowledgement\n\nThis work was funded by the Natural Sciences and Engineering Research Council of Canada.\n\nThis work was also funded by the Concordia University, Montreal, Canada.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fludlows%2Fpesq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fludlows%2Fpesq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fludlows%2Fpesq/lists"}