未验证 提交 764a5d42 编写于 作者: H Hui Zhang 提交者: GitHub

Merge branch 'develop' into ctc

...@@ -21,7 +21,6 @@ import struct ...@@ -21,7 +21,6 @@ import struct
import numpy as np import numpy as np
import resampy import resampy
import soundfile import soundfile
import soxbindings as sox
from scipy import signal from scipy import signal
from .utility import convert_samples_from_float32 from .utility import convert_samples_from_float32
...@@ -355,6 +354,19 @@ class AudioSegment(): ...@@ -355,6 +354,19 @@ class AudioSegment():
# self._samples = np.interp(new_indices, old_indices, self._samples) # self._samples = np.interp(new_indices, old_indices, self._samples)
# sox, slow # sox, slow
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." )
tfm = sox.Transformer() tfm = sox.Transformer()
tfm.set_globals(multithread=False) tfm.set_globals(multithread=False)
tfm.speed(speed_rate) tfm.speed(speed_rate)
......
...@@ -16,7 +16,6 @@ import librosa ...@@ -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(): ...@@ -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
......
...@@ -55,8 +55,6 @@ requirements = { ...@@ -55,8 +55,6 @@ requirements = {
"scipy", "scipy",
"sentencepiece~=0.1.96", "sentencepiece~=0.1.96",
"soundfile~=0.10", "soundfile~=0.10",
"sox",
"soxbindings",
"textgrid", "textgrid",
"timer", "timer",
"tqdm", "tqdm",
...@@ -74,6 +72,8 @@ requirements = { ...@@ -74,6 +72,8 @@ requirements = {
"Pillow", "Pillow",
"pybind11", "pybind11",
"snakeviz", "snakeviz",
"sox",
"soxbindings",
"unidecode", "unidecode",
"yq", "yq",
"pre-commit", "pre-commit",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册