Skip to content

Commit

Permalink
Apply fix for librosa dropping support for 16-bit audio.
Browse files Browse the repository at this point in the history
Based on @begeekmyfriend's PR.
  • Loading branch information
keithito committed Sep 5, 2018
1 parent d77e179 commit 91f4835
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions util/audio.py
Expand Up @@ -3,7 +3,7 @@
import math
import numpy as np
import tensorflow as tf
from scipy import signal
import scipy
from hparams import hparams


Expand All @@ -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):
Expand Down

0 comments on commit 91f4835

Please sign in to comment.