OLD | NEW |
1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 """Noise generators producing pairs of signals intended to be used to test the | 9 """Noise generators producing pairs of signals intended to be used to test the |
10 APM module. Each pair consists of a noisy and a reference signal. The former | 10 APM module. Each pair consists of a noisy and a reference signal. The former |
(...skipping 17 matching lines...) Expand all Loading... |
28 try: | 28 try: |
29 import scipy.io | 29 import scipy.io |
30 except ImportError: | 30 except ImportError: |
31 logging.critical('Cannot import the third-party Python package scipy') | 31 logging.critical('Cannot import the third-party Python package scipy') |
32 sys.exit(1) | 32 sys.exit(1) |
33 | 33 |
34 from . import data_access | 34 from . import data_access |
35 from . import exceptions | 35 from . import exceptions |
36 from . import signal_processing | 36 from . import signal_processing |
37 | 37 |
| 38 |
38 class NoiseGenerator(object): | 39 class NoiseGenerator(object): |
39 """Abstract class responsible for the generation of noisy signals. | 40 """Abstract class responsible for the generation of noisy signals. |
40 | 41 |
41 Given a clean signal, it generates two streams named noisy signal and | 42 Given a clean signal, it generates two streams named noisy signal and |
42 reference. The former is the clean signal deteriorated by the noise source, | 43 reference. The former is the clean signal deteriorated by the noise source, |
43 the latter goes through the same deterioration process, but more "gently". | 44 the latter goes through the same deterioration process, but more "gently". |
44 Noisy signal and reference are produced so that the reference is the signal | 45 Noisy signal and reference are produced so that the reference is the signal |
45 expected at the output of the APM module when the latter is fed with the nosiy | 46 expected at the output of the APM module when the latter is fed with the nosiy |
46 signal. | 47 signal. |
47 | 48 |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 # Apply impulse response. | 471 # Apply impulse response. |
471 processed_signal = ( | 472 processed_signal = ( |
472 signal_processing.SignalProcessingUtils.apply_impulse_response( | 473 signal_processing.SignalProcessingUtils.apply_impulse_response( |
473 input_signal, impulse_response)) | 474 input_signal, impulse_response)) |
474 | 475 |
475 # Save. | 476 # Save. |
476 signal_processing.SignalProcessingUtils.save_wav( | 477 signal_processing.SignalProcessingUtils.save_wav( |
477 noise_track_filepath, processed_signal) | 478 noise_track_filepath, processed_signal) |
478 | 479 |
479 return processed_signal | 480 return processed_signal |
OLD | NEW |