Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ESTOI #17

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 estoi
10 changes: 10 additions & 0 deletions speechmetrics/relative/estoi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from .stoi 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)
9 changes: 6 additions & 3 deletions speechmetrics/relative/stoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@


class STOI(Metric):
def __init__(self, window, hop=None):
super(STOI, self).__init__(name='STOI', window=window, hop=hop)
def __init__(self, window, hop=None, estoi=False):
name = 'ESTOI' if estoi else 'STOI'
super(STOI, self).__init__(name=name, 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)}
key = 'estoi' if self.estoi else 'stoi'
return {key: stoi(audios[1], audios[0], rate, extended=self.estoi)}


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