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 """Test data generators producing signals pairs intended to be used to | 9 """Test data generators producing signals pairs intended to be used to |
10 test the APM module. Each pair consists of a noisy input and a reference signal. | 10 test the APM module. Each pair consists of a noisy input and a reference signal. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 Raises: | 140 Raises: |
141 InputSignalCreatorException | 141 InputSignalCreatorException |
142 """ | 142 """ |
143 filename = os.path.splitext(os.path.split(input_signal_filepath)[-1])[0] | 143 filename = os.path.splitext(os.path.split(input_signal_filepath)[-1])[0] |
144 filename_parts = filename.split('-') | 144 filename_parts = filename.split('-') |
145 | 145 |
146 if len(filename_parts) < 2: | 146 if len(filename_parts) < 2: |
147 raise exceptions.InputSignalCreatorException( | 147 raise exceptions.InputSignalCreatorException( |
148 'Cannot parse input signal file name') | 148 'Cannot parse input signal file name') |
149 | 149 |
150 signal = input_signal_creator.InputSignalCreator.Create( | 150 signal, metadata = input_signal_creator.InputSignalCreator.Create( |
151 filename_parts[0], filename_parts[1].split('_')) | 151 filename_parts[0], filename_parts[1].split('_')) |
152 | 152 |
153 signal_processing.SignalProcessingUtils.SaveWav( | 153 signal_processing.SignalProcessingUtils.SaveWav( |
154 input_signal_filepath, signal) | 154 input_signal_filepath, signal) |
| 155 data_access.Metadata.SaveFileMetadata(input_signal_filepath, metadata) |
155 | 156 |
156 def _Generate( | 157 def _Generate( |
157 self, input_signal_filepath, test_data_cache_path, base_output_path): | 158 self, input_signal_filepath, test_data_cache_path, base_output_path): |
158 """Abstract method to be implemented in each concrete class. | 159 """Abstract method to be implemented in each concrete class. |
159 """ | 160 """ |
160 raise NotImplementedError() | 161 raise NotImplementedError() |
161 | 162 |
162 def _AddNoiseSnrPairs(self, base_output_path, noisy_mix_filepaths, | 163 def _AddNoiseSnrPairs(self, base_output_path, noisy_mix_filepaths, |
163 snr_value_pairs): | 164 snr_value_pairs): |
164 """Adds noisy-reference signal pairs. | 165 """Adds noisy-reference signal pairs. |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 # Apply impulse response. | 528 # Apply impulse response. |
528 processed_signal = ( | 529 processed_signal = ( |
529 signal_processing.SignalProcessingUtils.ApplyImpulseResponse( | 530 signal_processing.SignalProcessingUtils.ApplyImpulseResponse( |
530 input_signal, impulse_response)) | 531 input_signal, impulse_response)) |
531 | 532 |
532 # Save. | 533 # Save. |
533 signal_processing.SignalProcessingUtils.SaveWav( | 534 signal_processing.SignalProcessingUtils.SaveWav( |
534 noise_track_filepath, processed_signal) | 535 noise_track_filepath, processed_signal) |
535 | 536 |
536 return processed_signal | 537 return processed_signal |
OLD | NEW |