Skip to content

Commit

Permalink
Merge pull request aliutkus#24 from turian/pesq
Browse files Browse the repository at this point in the history
Wide-band PESQ
  • Loading branch information
aliutkus authored Apr 26, 2021
2 parents 06a1473 + 9c06724 commit 975b79d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ As presented in [this](https://hal-lirmm.ccsd.cnrs.fr/lirmm-01766791v2/document)
### PESQ (`relative.pesq` or `pesq`)
*dimensionless, higher is better. 0=very bad, 5=very good*

Wide band PESQ.
As implemented [there](https://github.com/ludlows/python-pesq) by
[@ludlows](https://github.com/ludlows). [Pranay
Manocha](https://github.com/pranaymanocha): "[This implementation]
matches with a very old matlab implementation of Phillip Loizou’s
book. (I personally verified that)"

### NBPESQ (`relative.nb_pesq` or `nb_pesq`)
*dimensionless, higher is better. 0=very bad, 5=very good*

Narrow band PESQ.
As implemented [there](https://github.com/vBaiCai/python-pesq) by [@vBaiCai](https://github.com/vBaiCai).

### STOI (`relative.stoi` or `stoi`)
Expand Down
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
'resampy',
'pystoi',
'museval',
'gammatone @ git+https://github.com/detly/gammatone',
# This is requred, but srmrpy pull it in,
# and there is a pip3 conflict if we have the following
# line.
#'gammatone @ git+https://github.com/detly/gammatone',
'pypesq @ git+https://github.com/vBaiCai/python-pesq',
'srmrpy @ git+https://github.com/jfsantos/SRMRpy',
'pesq @ git+https://github.com/ludlows/python-pesq',
],
extras_require={
'cpu': ['tensorflow==2.0.0', 'librosa'],
'gpu': ['tensorflow-gpu==2.0.0', 'librosa'],
'cpu': ['tensorflow>=2.0.0', 'librosa'],
'gpu': ['tensorflow-gpu>=2.0.0', 'librosa'],
},
include_package_data=True
)
1 change: 1 addition & 0 deletions speechmetrics/relative/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import bsseval
from . import pesq
from . import stoi
from . import nb_pesq
18 changes: 18 additions & 0 deletions speechmetrics/relative/nb_pesq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from .. import Metric


class NBPESQ(Metric):
def __init__(self, window, hop=None):
super(NBPESQ, self).__init__(name='NBPESQ', window=window, hop=hop)
self.mono = True
self.fixed_rate = 16000

def test_window(self, audios, rate):
from pypesq import pesq
if len(audios) != 2:
raise ValueError('NB_PESQ needs a reference and a test signals.')
return {'nb_pesq': pesq(audios[1], audios[0], rate)}


def load(window, hop=None):
return NBPESQ(window, hop)
4 changes: 2 additions & 2 deletions speechmetrics/relative/pesq.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def __init__(self, window, hop=None):
self.fixed_rate = 16000

def test_window(self, audios, rate):
from pypesq import pesq
from pesq import pesq
if len(audios) != 2:
raise ValueError('PESQ needs a reference and a test signals.')
return {'pesq': pesq(audios[1], audios[0], rate)}
return {'pesq': pesq(rate, audios[1], audios[0], 'wb')}


def load(window, hop=None):
Expand Down

0 comments on commit 975b79d

Please sign in to comment.