Skip to content
This repository was archived by the owner on Aug 3, 2021. It is now read-only.

Commit 1f84eec

Browse files
committed
Updated tests for python_speech_features
Signed-off-by: Vitaly Lavrukhin <[email protected]>
1 parent e558c14 commit 1f84eec

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

open_seq2seq/data/speech2text/speech_utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,10 @@ def get_speech_features_psf(signal, sample_freq, num_features,
460460
audio_duration (float): duration of the signal in seconds
461461
"""
462462
if augmentation is not None:
463-
signal = augment_audio_signal(signal, sample_freq, augmentation)
464-
else:
465-
signal = (normalize_signal(signal.astype(np.float32)) * 32767.0).astype(
466-
np.int16)
463+
signal = augment_audio_signal(signal.astype(np.float32),
464+
sample_freq, augmentation)
465+
signal = (normalize_signal(signal.astype(np.float32)) * 32767.0).astype(
466+
np.int16)
467467

468468
audio_duration = len(signal) * 1.0 / sample_freq
469469

open_seq2seq/data/speech2text/speech_utils_test.py

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class SpeechUtilsTests(tf.test.TestCase):
2020
def test_augment_audio_signal(self):
2121
filename = 'open_seq2seq/test_utils/toy_speech_data/wav_files/46gc040q.wav'
2222
freq_s, signal = wave.read(filename)
23+
signal = signal.astype(np.float32)
2324
augmentation = {
2425
'speed_perturbation_ratio': 0.2,
2526
'noise_level_min': -90,

0 commit comments

Comments
 (0)