Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Unified Diff: webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/signal_processing.py

Issue 2718063003: POLQA evaluation score. (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/signal_processing.py
diff --git a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/signal_processing.py b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/signal_processing.py
index 76b103d091b16544131365af04f8adab86abd6cf..f611eca0dc2e4f4a53252260496fd213de298525 100644
--- a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/signal_processing.py
+++ b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/signal_processing.py
@@ -8,6 +8,7 @@
import array
import logging
+import os
import sys
try:
@@ -29,9 +30,7 @@ except ImportError:
logging.critical('Cannot import the third-party Python package scipy')
sys.exit(1)
-
-class SignalProcessingException(Exception):
- pass
+from . import exceptions
class SignalProcessingUtils(object):
@@ -46,6 +45,9 @@ class SignalProcessingUtils(object):
Return:
AudioSegment instance.
"""
+ if not os.path.exists(filepath):
+ logging.error('cannot find the <%s> audio track file', filepath)
+ raise exceptions.FileNotFoundError()
return pydub.AudioSegment.from_file(
filepath, format='wav', channels=channels)
@@ -175,10 +177,12 @@ class SignalProcessingUtils(object):
noise_power = float(noise.dBFS)
if signal_power == -np.Inf:
logging.error('signal has -Inf power, cannot mix')
- raise SignalProcessingException('cannot mix a signal with -Inf power')
+ raise exceptions.SignalProcessingException(
+ 'cannot mix a signal with -Inf power')
if noise_power == -np.Inf:
logging.error('noise has -Inf power, cannot mix')
- raise SignalProcessingException('cannot mix a signal with -Inf power')
+ raise exceptions.SignalProcessingException(
+ 'cannot mix a signal with -Inf power')
# Pad signal (if necessary). If noise is the shortest, the AudioSegment
# overlay() method implictly pads noise. Hence, the only case to handle

Powered by Google App Engine
This is Rietveld 408576698