From 91f48351f23f042256dec9e06a3405eddf31d027 Mon Sep 17 00:00:00 2001 From: Keith Ito Date: Wed, 5 Sep 2018 19:46:12 -0400 Subject: [PATCH] Apply fix for librosa dropping support for 16-bit audio. Based on @begeekmyfriend's PR. --- util/audio.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/audio.py b/util/audio.py index 7b9cf04..1362f91 100644 --- a/util/audio.py +++ b/util/audio.py @@ -3,7 +3,7 @@ import math import numpy as np import tensorflow as tf -from scipy import signal +import scipy from hparams import hparams @@ -13,15 +13,15 @@ def load_wav(path): def save_wav(wav, path): wav *= 32767 / max(0.01, np.max(np.abs(wav))) - librosa.output.write_wav(path, wav.astype(np.int16), hparams.sample_rate) + scipy.io.wavfile.write(path, hparams.sample_rate, wav.astype(np.int16)) def preemphasis(x): - return signal.lfilter([1, -hparams.preemphasis], [1], x) + return scipy.signal.lfilter([1, -hparams.preemphasis], [1], x) def inv_preemphasis(x): - return signal.lfilter([1], [1, -hparams.preemphasis], x) + return scipy.signal.lfilter([1], [1, -hparams.preemphasis], x) def spectrogram(y):