use soundfile for faster read

This commit is contained in:
Eren Golge 2019-05-23 01:52:37 +02:00
parent c6f970b65b
commit d4b900f6c9
3 changed files with 4 additions and 2 deletions

View File

@ -753,7 +753,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.7.2"
}
},
"nbformat": 4,

View File

@ -83,6 +83,7 @@ setup(
# "lws",
"tqdm",
"phonemizer",
"soundfile",
],
dependency_links=[
'http://github.com/bootphon/phonemizer/tarball/master#egg=phonemizer'

View File

@ -1,5 +1,6 @@
import os
import librosa
import soundfile as sf
import pickle
import copy
import numpy as np
@ -230,7 +231,7 @@ class AudioProcessor(object):
# return np.sign(signal) * magnitude
def load_wav(self, filename, encode=False):
x, sr = librosa.load(filename, sr=self.sample_rate)
x, sr = sf.read(filename)
if self.do_trim_silence:
x = self.trim_silence(x)
# sr, x = io.wavfile.read(filename)