From cdd52ac2706929ea993038aedce3080eb2de8af8 Mon Sep 17 00:00:00 2001 From: Xinghai Sun Date: Mon, 26 Jun 2017 14:17:22 +0800 Subject: [PATCH] Fix a missing abs bug for DS2 AudioSegment. --- data_utils/audio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_utils/audio.py b/data_utils/audio.py index 1faeb48a..d55fae1e 100644 --- a/data_utils/audio.py +++ b/data_utils/audio.py @@ -378,7 +378,7 @@ class AudioSegment(object): :type shift_ms: float :raises ValueError: If shift_ms is longer than audio duration. """ - if shift_ms / 1000.0 > self.duration: + if abs(shift_ms) / 1000.0 > self.duration: raise ValueError("Absolute value of shift_ms should be smaller " "than audio duration.") shift_samples = int(shift_ms * self._sample_rate / 1000)