Python源码示例:hparams.hparams.preemphasis()
示例1
def _preemphasis(x):
return signal.lfilter([1, -hparams.preemphasis], [1], x)
示例2
def _inv_preemphasis(x):
return signal.lfilter([1], [1, -hparams.preemphasis], x)
示例3
def _inv_preemphasis(x):
N = tf.shape(x)[0]
i = tf.constant(0)
W = tf.zeros(shape=tf.shape(x), dtype=tf.float32)
def condition(i, y):
return tf.less(i, N)
def body(i, y):
tmp = tf.slice(x, [0], [i + 1])
tmp = tf.concat([tf.zeros([N - i - 1]), tmp], -1)
y = hparams.preemphasis * y + tmp
i = tf.add(i, 1)
return [i, y]
final = tf.while_loop(condition, body, [i, W])
y = final[1]
return y
示例4
def preemphasis(x):
return scipy.signal.lfilter([1, -hparams.preemphasis], [1], x)
示例5
def inv_preemphasis(x):
return scipy.signal.lfilter([1], [1, -hparams.preemphasis], x)
示例6
def spectrogram(y):
D = _stft(preemphasis(y))
S = _amp_to_db(np.abs(D)) - hparams.ref_level_db
return _normalize(S)
示例7
def inv_spectrogram_tensorflow(spectrogram):
'''Builds computational graph to convert spectrogram to waveform using TensorFlow.
Unlike inv_spectrogram, this does NOT invert the preemphasis. The caller should call
inv_preemphasis on the output after running the graph.
'''
S = _db_to_amp_tensorflow(_denormalize_tensorflow(spectrogram) + hparams.ref_level_db)
return _griffin_lim_tensorflow(tf.pow(S, hparams.power))
示例8
def melspectrogram(y):
D = _stft(preemphasis(y))
S = _amp_to_db(_linear_to_mel(np.abs(D))) - hparams.ref_level_db
return _normalize(S)
示例9
def preemphasis(x):
return signal.lfilter([1, -hparams.preemphasis], [1], x)
示例10
def inv_preemphasis(x):
return signal.lfilter([1], [1, -hparams.preemphasis], x)
示例11
def preemphasis(x):
return signal.lfilter([1, -hparams.preemphasis], [1], x)
示例12
def inv_preemphasis(x):
return signal.lfilter([1], [1, -hparams.preemphasis], x)
示例13
def preemphasis(x):
return signal.lfilter([1, -hparams.preemphasis], [1], x)
示例14
def inv_preemphasis(x):
return signal.lfilter([1], [1, -hparams.preemphasis], x)
示例15
def spectrogram(y):
D = _stft(preemphasis(y))
S = _amp_to_db(np.abs(D)) - hparams.ref_level_db
return _normalize(S)
示例16
def inv_spectrogram_tensorflow(spectrogram):
'''Builds computational graph to convert spectrogram to waveform using TensorFlow.
Unlike inv_spectrogram, this does NOT invert the preemphasis. The caller should call
inv_preemphasis on the output after running the graph.
'''
S = _db_to_amp_tensorflow(_denormalize_tensorflow(spectrogram) + hparams.ref_level_db)
return _griffin_lim_tensorflow(tf.pow(S, hparams.power))
示例17
def melspectrogram(y):
D = _stft(preemphasis(y))
S = _amp_to_db(_linear_to_mel(np.abs(D))) - hparams.ref_level_db
return _normalize(S)
示例18
def preemphasis(x):
return scipy.signal.lfilter([1, -hparams.preemphasis], [1], x)
示例19
def inv_preemphasis(x):
return scipy.signal.lfilter([1], [1, -hparams.preemphasis], x)
示例20
def spectrogram(y):
D = _stft(preemphasis(y))
S = _amp_to_db(np.abs(D)) - hparams.ref_level_db
return _normalize(S)
示例21
def inv_spectrogram_tensorflow(spectrogram):
'''Builds computational graph to convert spectrogram to waveform using TensorFlow.
Unlike inv_spectrogram, this does NOT invert the preemphasis. The caller should call
inv_preemphasis on the output after running the graph.
'''
S = _db_to_amp_tensorflow(_denormalize_tensorflow(spectrogram) + hparams.ref_level_db)
return _griffin_lim_tensorflow(tf.pow(S, hparams.power))
示例22
def melspectrogram(y):
D = _stft(preemphasis(y))
S = _amp_to_db(_linear_to_mel(np.abs(D))) - hparams.ref_level_db
return _normalize(S)
示例23
def preemphasis(x):
from nnmnkwii.preprocessing import preemphasis
return preemphasis(x, hparams.preemphasis)
示例24
def inv_preemphasis(x):
from nnmnkwii.preprocessing import inv_preemphasis
return inv_preemphasis(x, hparams.preemphasis)
示例25
def spectrogram(y):
D = _lws_processor().stft(preemphasis(y)).T
S = _amp_to_db(np.abs(D)) - hparams.ref_level_db
return _normalize(S)
示例26
def melspectrogram(y):
D = _lws_processor().stft(preemphasis(y)).T
S = _amp_to_db(_linear_to_mel(np.abs(D))) - hparams.ref_level_db
if not hparams.allow_clipping_in_normalization:
assert S.max() <= 0 and S.min() - hparams.min_level_db >= 0
return _normalize(S)
示例27
def preemphasis(x):
return signal.lfilter([1, -hparams.preemphasis], [1], x)
示例28
def inv_preemphasis(x):
return signal.lfilter([1], [1, -hparams.preemphasis], x)
示例29
def preemphasis(x):
return signal.lfilter([1, -hparams.preemphasis], [1], x)
示例30
def inv_preemphasis(x):
return signal.lfilter([1], [1, -hparams.preemphasis], x)