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

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: Merge + comments from Per addressed 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..730facb799c9820d0c006116dc6483c3fbb1158a
--- /dev/null
+++ b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/echo_path_simulation.py
@@ -0,0 +1,101 @@
+# 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 capture and the render signals
peah-webrtc 2017/05/03 08:10:08 I would not characterize an echo path simulator as
AleBzk 2017/05/15 08:22:57 Thanks a lot for this comment. I mixed two respons
+ 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 render input and then it sums the
peah-webrtc 2017/05/03 08:10:08 This is not clear to me: then it sums the signal t
peah-webrtc 2017/05/03 08:10:08 Please replace "It" with something else, as it is
AleBzk 2017/05/15 08:22:57 Doesn't apply anymore.
+ signal to the capture input signal.
+ """
+
+ NAME = 'linear'
+
+ def __init__(self, capture_input_filepath, render_input_filepath,
+ impulse_response):
+ EchoPathSimulator.__init__(self)
+ # TODO(alessiob): Remove once ctor implemented.
+ logging.debug(capture_input_filepath)
+ logging.debug(render_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
peah-webrtc 2017/05/03 08:10:08 What makes RecordedEchoPathSimulator from LinearEc
AleBzk 2017/05/15 08:22:57 Fixed. I also added the implementation and a "no e
+class RecordedEchoPathSimulator(EchoPathSimulator):
+ """Uses recorded echo.
+
+ It uses the clean capture input file name to build the file name of the
peah-webrtc 2017/05/03 08:10:08 This is an echopath simulator, and I think it woul
AleBzk 2017/05/15 08:22:57 Well, I could describe the setup to record echo. B
+ corresponding recording containing capture input and echo. Such file is
peah-webrtc 2017/05/03 08:10:08 Such a file
AleBzk 2017/05/15 08:22:57 Done.
+ expected to be already existing.
+ """
+
+ NAME = 'recorded'
+
+ def __init__(self, capture_input_filepath):
+ EchoPathSimulator.__init__(self)
+ # TODO(alessiob): Remove once ctor implemented.
+ logging.debug(capture_input_filepath)
+
+ def Simulate(self, output_path):
+ """Uses recorded echo path."""
+ # TODO(alessiob): Implement.
+ pass

Powered by Google App Engine
This is Rietveld 408576698