提交 904baec3 编写于 作者: P Philip

Fix PaddlePaddle/DeepSpeech#141: DS always reject silent audio

上级 6d8a2de6
...@@ -639,6 +639,8 @@ class AudioSegment(object): ...@@ -639,6 +639,8 @@ class AudioSegment(object):
""" """
# square root => multiply by 10 instead of 20 for dBs # square root => multiply by 10 instead of 20 for dBs
mean_square = np.mean(self._samples**2) mean_square = np.mean(self._samples**2)
if mean_square == 0.:
return 0.
return 10 * np.log10(mean_square) return 10 * np.log10(mean_square)
def _convert_samples_to_float32(self, samples): def _convert_samples_to_float32(self, samples):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册