|
|
@ -16,7 +16,6 @@ import librosa
|
|
|
|
import numpy
|
|
|
|
import numpy
|
|
|
|
import scipy
|
|
|
|
import scipy
|
|
|
|
import soundfile
|
|
|
|
import soundfile
|
|
|
|
import soxbindings as sox
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from paddlespeech.s2t.io.reader import SoundHDF5File
|
|
|
|
from paddlespeech.s2t.io.reader import SoundHDF5File
|
|
|
|
|
|
|
|
|
|
|
@ -146,6 +145,19 @@ class SpeedPerturbationSox():
|
|
|
|
self.keep_length = keep_length
|
|
|
|
self.keep_length = keep_length
|
|
|
|
self.state = numpy.random.RandomState(seed)
|
|
|
|
self.state = numpy.random.RandomState(seed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
import soxbindings as sox
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
from paddlespeech.s2t.utils import dynamic_pip_install
|
|
|
|
|
|
|
|
package = "sox"
|
|
|
|
|
|
|
|
dynamic_pip_install.install(package)
|
|
|
|
|
|
|
|
package = "soxbindings"
|
|
|
|
|
|
|
|
dynamic_pip_install.install(package)
|
|
|
|
|
|
|
|
import soxbindings as sox
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
raise RuntimeError("Can not install soxbindings on your system." )
|
|
|
|
|
|
|
|
|
|
|
|
if utt2ratio is not None:
|
|
|
|
if utt2ratio is not None:
|
|
|
|
self.utt2ratio = {}
|
|
|
|
self.utt2ratio = {}
|
|
|
|
# Use the scheduled ratio for each utterances
|
|
|
|
# Use the scheduled ratio for each utterances
|
|
|
|