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

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

Issue 2813883002: APM QA refactoring: render stream support, echo path simulation, new export engine (Closed)
Patch Set: removing details about the experiment Created 3 years, 8 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/echo_path_simulation.py
diff --git a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/echo_path_simulation.py b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/echo_path_simulation.py
new file mode 100644
index 0000000000000000000000000000000000000000..acb44356a3f3b723461458bc95e6d72c492ae409
--- /dev/null
+++ b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/echo_path_simulation.py
@@ -0,0 +1,100 @@
+# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+"""Echo path simulation module.
+"""
+
+import logging
+
+
+class EchoPathSimulator(object):
+ """Abstract class for the echo path simulators.
+
+ In general, an echo path simulator mixes the near-end and the far-end
+ simulating what a microphone records due to the presence of echo paths (e.g.,
+ mechanical or electrical path).
+ """
+
+ NAME = None
+ REGISTERED_CLASSES = {}
+
+ def __init__(self):
+ pass
+
+ def Simulate(self, output_path):
+ """Simulates echo path (abstract method).
+
+ Args:
+ output_path: Path in which any output can be saved.
+
+ Returns:
+ Path to the generated audio track file.
+ """
+ # TODO(alessiob): Remove once ctor implemented.
+ raise NotImplementedError()
+
+ @classmethod
+ def RegisterClass(cls, class_to_register):
+ """Registers an EchoPathSimulator implementation.
+
+ Decorator to automatically register the classes that extend
+ EchoPathSimulator.
+ Example usage:
+
+ @EchoPathSimulator.RegisterClass
+ class LinearEchoPathSimulator(EchoPathSimulator):
+ pass
+ """
+ cls.REGISTERED_CLASSES[class_to_register.NAME] = class_to_register
+ return class_to_register
+
+
+@EchoPathSimulator.RegisterClass
+class LinearEchoPathSimulator(EchoPathSimulator):
+ """Simulates linear echo path.
+
+ It applies a given impulse response to the reverse input and then it sums the
+ signal to the forward input.
+ """
+
+ NAME = 'linear'
+
+ def __init__(self, input_filepath, reverse_input_filepath, impulse_response):
+ EchoPathSimulator.__init__(self)
+ # TODO(alessiob): Remove once ctor implemented.
+ logging.debug(input_filepath)
+ logging.debug(reverse_input_filepath)
+ logging.debug(impulse_response)
+
+ def Simulate(self, output_path):
+ """Simulates linear echo path."""
+ # TODO(alessiob): Implement.
+ pass
+
+
+# TODO(alessiob): Remove comment when class implemented.
+# @EchoPathSimulator.RegisterClass
+class RecordedEchoPathSimulator(EchoPathSimulator):
+ """Uses recorded echo.
+
+ It uses the clean forward input file name to build the file name of the
+ corresponding recording containing forward input and echo. Such file is
+ expected to be already existing.
+ """
+
+ NAME = 'recorded'
+
+ def __init__(self, input_filepath):
+ EchoPathSimulator.__init__(self)
+ # TODO(alessiob): Remove once ctor implemented.
+ logging.debug(input_filepath)
+
+ def Simulate(self, output_path):
+ """Uses recorded echo path."""
+ # TODO(alessiob): Implement.
+ pass

Powered by Google App Engine
This is Rietveld 408576698