Python hparams.hparams.allow_clipping_in_normalization() Examples
The following are 14
code examples of hparams.hparams.allow_clipping_in_normalization().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
hparams.hparams
, or try the search function
.
Example #1
Source File: audio.py From vae_tacotron2 with MIT License | 5 votes |
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))
Example #2
Source File: audio.py From vae_tacotron2 with MIT License | 5 votes |
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)
Example #3
Source File: audio.py From vae_tacotron2 with MIT License | 5 votes |
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))
Example #4
Source File: audio.py From vae_tacotron2 with MIT License | 5 votes |
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)
Example #5
Source File: audio.py From cnn_vocoder with MIT License | 5 votes |
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)
Example #6
Source File: audio.py From WaveRNN-Pytorch with MIT License | 5 votes |
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)
Example #7
Source File: audio.py From gmvae_tacotron with MIT License | 5 votes |
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))
Example #8
Source File: audio.py From gmvae_tacotron with MIT License | 5 votes |
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)
Example #9
Source File: audio.py From gmvae_tacotron with MIT License | 5 votes |
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))
Example #10
Source File: audio.py From gmvae_tacotron with MIT License | 5 votes |
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)
Example #11
Source File: audio.py From representation_mixing with BSD 3-Clause "New" or "Revised" License | 5 votes |
def melspectrogram(y): D = _lws_processor().stft(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)
Example #12
Source File: audio.py From representation_mixing with BSD 3-Clause "New" or "Revised" License | 5 votes |
def melspectrogram(y): D = _lws_processor().stft(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)
Example #13
Source File: audio.py From representation_mixing with BSD 3-Clause "New" or "Revised" License | 5 votes |
def melspectrogram(y): D = _lws_processor().stft(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)
Example #14
Source File: audio.py From representation_mixing with BSD 3-Clause "New" or "Revised" License | 5 votes |
def melspectrogram(y): D = _lws_processor().stft(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)