mirror of https://github.com/coqui-ai/TTS.git
refactor(audio.processor): use pre-/deemphasis from numpy_transforms
This commit is contained in:
parent
f37cc4c028
commit
11e98d3dac
|
@ -13,9 +13,11 @@ from TTS.utils.audio.numpy_transforms import (
|
||||||
build_mel_basis,
|
build_mel_basis,
|
||||||
compute_f0,
|
compute_f0,
|
||||||
db_to_amp,
|
db_to_amp,
|
||||||
|
deemphasis,
|
||||||
griffin_lim,
|
griffin_lim,
|
||||||
mel_to_spec,
|
mel_to_spec,
|
||||||
millisec_to_length,
|
millisec_to_length,
|
||||||
|
preemphasis,
|
||||||
spec_to_mel,
|
spec_to_mel,
|
||||||
stft,
|
stft,
|
||||||
)
|
)
|
||||||
|
@ -387,15 +389,11 @@ class AudioProcessor(object):
|
||||||
Returns:
|
Returns:
|
||||||
np.ndarray: Decorrelated audio signal.
|
np.ndarray: Decorrelated audio signal.
|
||||||
"""
|
"""
|
||||||
if self.preemphasis == 0:
|
return preemphasis(x=x, coef=self.preemphasis)
|
||||||
raise RuntimeError(" [!] Preemphasis is set 0.0.")
|
|
||||||
return scipy.signal.lfilter([1, -self.preemphasis], [1], x)
|
|
||||||
|
|
||||||
def apply_inv_preemphasis(self, x: np.ndarray) -> np.ndarray:
|
def apply_inv_preemphasis(self, x: np.ndarray) -> np.ndarray:
|
||||||
"""Reverse pre-emphasis."""
|
"""Reverse pre-emphasis."""
|
||||||
if self.preemphasis == 0:
|
return deemphasis(x=x, coef=self.preemphasis)
|
||||||
raise RuntimeError(" [!] Preemphasis is set 0.0.")
|
|
||||||
return scipy.signal.lfilter([1], [1, -self.preemphasis], x)
|
|
||||||
|
|
||||||
### SPECTROGRAMs ###
|
### SPECTROGRAMs ###
|
||||||
def spectrogram(self, y: np.ndarray) -> np.ndarray:
|
def spectrogram(self, y: np.ndarray) -> np.ndarray:
|
||||||
|
|
Loading…
Reference in New Issue