本文整理匯總了Python中hparams.hparams.min_level_db方法的典型用法代碼示例。如果您正苦於以下問題:Python hparams.min_level_db方法的具體用法?Python hparams.min_level_db怎麽用?Python hparams.min_level_db使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hparams.hparams
的用法示例。
在下文中一共展示了hparams.min_level_db方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _normalize
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _normalize(S):
return np.clip(
(2 * hparams.max_abs_value) * ((S - hparams.min_level_db) / (-hparams.min_level_db)) - hparams.max_abs_value,
-hparams.max_abs_value, hparams.max_abs_value)
示例2: _denormalize
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _denormalize(D):
return (((np.clip(D, -hparams.max_abs_value,
hparams.max_abs_value) + hparams.max_abs_value) * -hparams.min_level_db / (
2 * hparams.max_abs_value))
+ hparams.min_level_db)
示例3: _denormalize
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _denormalize(D):
return (((tf.clip_by_value(D, -hparams.max_abs_value,
hparams.max_abs_value) + hparams.max_abs_value) * -hparams.min_level_db / (
2 * hparams.max_abs_value)) + hparams.min_level_db)
示例4: _normalize
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _normalize(S):
return np.clip((S - hparams.min_level_db) / -hparams.min_level_db, 0, 1)
示例5: _denormalize
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _denormalize(S):
return (np.clip(S, 0, 1) * -hparams.min_level_db) + hparams.min_level_db
示例6: _denormalize_tensorflow
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _denormalize_tensorflow(S):
return (tf.clip_by_value(S, 0, 1) * -hparams.min_level_db) + hparams.min_level_db
示例7: _amp_to_db
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _amp_to_db(x):
min_level = np.exp(hparams.min_level_db / 20 * np.log(10))
return 20 * np.log10(np.maximum(min_level, x))
示例8: _normalize
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _normalize(S):
if hparams.allow_clipping_in_normalization:
if hparams.symmetric_mels:
return np.clip((2 * hparams.max_abs_value) * ((S - hparams.min_level_db) / (-hparams.min_level_db)) - hparams.max_abs_value,
-hparams.max_abs_value, hparams.max_abs_value)
else:
return np.clip(hparams.max_abs_value * ((S - hparams.min_level_db) / (-hparams.min_level_db)), 0, hparams.max_abs_value)
assert S.max() <= 0 and S.min() - hparams.min_level_db >= 0
if hparams.symmetric_mels:
return (2 * hparams.max_abs_value) * ((S - hparams.min_level_db) / (-hparams.min_level_db)) - hparams.max_abs_value
else:
return hparams.max_abs_value * ((S - hparams.min_level_db) / (-hparams.min_level_db))
示例9: _denormalize
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _denormalize(D):
if hparams.allow_clipping_in_normalization:
if hparams.symmetric_mels:
return (((np.clip(D, -hparams.max_abs_value,
hparams.max_abs_value) + hparams.max_abs_value) * -hparams.min_level_db / (2 * hparams.max_abs_value))
+ hparams.min_level_db)
else:
return ((np.clip(D, 0, hparams.max_abs_value) * -hparams.min_level_db / hparams.max_abs_value) + hparams.min_level_db)
if hparams.symmetric_mels:
return (((D + hparams.max_abs_value) * -hparams.min_level_db / (2 * hparams.max_abs_value)) + hparams.min_level_db)
else:
return ((D * -hparams.min_level_db / hparams.max_abs_value) + hparams.min_level_db)
示例10: melspectrogram
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def melspectrogram(y):
D = _stft(y)
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)
示例11: _amp_to_db
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _amp_to_db(x):
min_level = np.exp(hparams.min_level_db / 20 * np.log(10))
return 20 * np.log10(np.maximum(min_level, x))
示例12: _normalize
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _normalize(S):
return np.clip((S - hparams.min_level_db) / -hparams.min_level_db, 0, 1)
示例13: _denormalize
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _denormalize(S):
return (np.clip(S, 0, 1) * -hparams.min_level_db) + hparams.min_level_db
示例14: _normalize
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
def _normalize(S):
return (S - hparams.min_level_db)/-hparams.min_level_db
示例15: melspectrogram
# 需要導入模塊: from hparams import hparams [as 別名]
# 或者: from hparams.hparams import min_level_db [as 別名]
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)