diff --git a/notebooks/NB4a - Alternative Model (Preprocessing).ipynb b/notebooks/NB4a - Alternative Model (Preprocessing).ipynb index 79d8d1fd..ab628b5a 100644 --- a/notebooks/NB4a - Alternative Model (Preprocessing).ipynb +++ b/notebooks/NB4a - Alternative Model (Preprocessing).ipynb @@ -20,7 +20,8 @@ "import math, pickle, os, glob\n", "import numpy as np\n", "from utils.display import *\n", - "from utils.dsp import *" + "from utils.dsp import *\n", + "import soundfile as sf" ] }, { @@ -157,7 +158,7 @@ "metadata": {}, "outputs": [], "source": [ - "librosa.output.write_wav(DATA_PATH + 'test_quant.wav', x, sr=sample_rate)" + "sf.write(DATA_PATH + 'test_quant.wav', x, sample_rate, subtype='PCM_24')" ] }, { diff --git a/requirements.txt b/requirements.txt index aa7140a6..b0326613 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ numpy==1.16.2 -librosa==0.6.3 +librosa +soundfile matplotlib unidecode inflect -nltk \ No newline at end of file +nltk diff --git a/utils/dsp.py b/utils/dsp.py index 885d34db..00c4384e 100644 --- a/utils/dsp.py +++ b/utils/dsp.py @@ -1,6 +1,7 @@ import math import numpy as np import librosa +import soundfile as sf from utils import hparams as hp from scipy.signal import lfilter @@ -20,7 +21,7 @@ def load_wav(path): def save_wav(x, path): - librosa.output.write_wav(path, x.astype(np.float32), sr=hp.sample_rate) + sf.write(path, x.astype(np.float32), hp.sample_rate, subtype='PCM_24') def split_signal(x):