From ba2772c14467e498ae8737071c7db646b6519331 Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Sat, 1 Aug 2020 09:35:50 +0200 Subject: [PATCH 1/6] Add ESTOI --- speechmetrics/relative/stoi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/speechmetrics/relative/stoi.py b/speechmetrics/relative/stoi.py index 38a248f..4e08bc2 100644 --- a/speechmetrics/relative/stoi.py +++ b/speechmetrics/relative/stoi.py @@ -2,16 +2,17 @@ class STOI(Metric): - def __init__(self, window, hop=None): + def __init__(self, window, hop=None, estoi=False): super(STOI, self).__init__(name='STOI', window=window, hop=hop) self.mono = True + self.estoi = estoi def test_window(self, audios, rate): from pystoi.stoi import stoi if len(audios) != 2: raise ValueError('STOI needs a reference and a test signals.') - return {'stoi':stoi(audios[1], audios[0], rate, extended=False)} + return {'stoi':stoi(audios[1], audios[0], rate, extended=self.estoi)} def load(window, hop=None): From c0390a8925689c7d5fcd8e1a0e357dd06a34f23c Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Sat, 1 Aug 2020 09:37:25 +0200 Subject: [PATCH 2/6] Add ESTOI --- speechmetrics/relative/estoi.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 speechmetrics/relative/estoi.py diff --git a/speechmetrics/relative/estoi.py b/speechmetrics/relative/estoi.py new file mode 100644 index 0000000..c279835 --- /dev/null +++ b/speechmetrics/relative/estoi.py @@ -0,0 +1,10 @@ +from . import STOI + + +class ESTOI(STOI): + def __init__(self, *args, **kwargs): + super(ESTOI, self).__init__(*args, **kwargs, estoi=True) + + +def load(window, hop=None): + return ESTOI(window, hop) From 6ee3d4aead17e7d900417ff441687cd57ad1eba3 Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Sat, 1 Aug 2020 09:38:24 +0200 Subject: [PATCH 3/6] Add ESTOI --- speechmetrics/relative/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/speechmetrics/relative/__init__.py b/speechmetrics/relative/__init__.py index bf2e691..326ac5a 100644 --- a/speechmetrics/relative/__init__.py +++ b/speechmetrics/relative/__init__.py @@ -1,3 +1,4 @@ from . import bsseval from . import pesq from . import stoi +from . import estoi From 8170fbcba2a7555afc39b07785b3b198dcf2b7d9 Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Sat, 1 Aug 2020 09:43:19 +0200 Subject: [PATCH 4/6] Add ESTOI --- speechmetrics/relative/estoi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/speechmetrics/relative/estoi.py b/speechmetrics/relative/estoi.py index c279835..0382a97 100644 --- a/speechmetrics/relative/estoi.py +++ b/speechmetrics/relative/estoi.py @@ -1,4 +1,4 @@ -from . import STOI +from .stoi import STOI class ESTOI(STOI): From 49a7f039890c9c36a1b50a1d65b017bfe19bee1e Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Sat, 1 Aug 2020 09:49:52 +0200 Subject: [PATCH 5/6] Add ESTOI --- speechmetrics/relative/stoi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/speechmetrics/relative/stoi.py b/speechmetrics/relative/stoi.py index 4e08bc2..ce1fc58 100644 --- a/speechmetrics/relative/stoi.py +++ b/speechmetrics/relative/stoi.py @@ -3,7 +3,8 @@ class STOI(Metric): def __init__(self, window, hop=None, estoi=False): - super(STOI, self).__init__(name='STOI', window=window, hop=hop) + name = 'ESTOI' if estoi else 'STOI' + super(STOI, self).__init__(name=name, window=window, hop=hop) self.mono = True self.estoi = estoi From 6a7088b911c6d210e35b70ad9f7a7070353b651d Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Sat, 1 Aug 2020 11:07:42 +0200 Subject: [PATCH 6/6] Add ESTOI --- speechmetrics/relative/stoi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/speechmetrics/relative/stoi.py b/speechmetrics/relative/stoi.py index ce1fc58..fbde602 100644 --- a/speechmetrics/relative/stoi.py +++ b/speechmetrics/relative/stoi.py @@ -13,7 +13,8 @@ def test_window(self, audios, rate): if len(audios) != 2: raise ValueError('STOI needs a reference and a test signals.') - return {'stoi':stoi(audios[1], audios[0], rate, extended=self.estoi)} + key = 'estoi' if self.estoi else 'stoi' + return {key: stoi(audios[1], audios[0], rate, extended=self.estoi)} def load(window, hop=None):