Python hparams.hparams.ref_level_db() Examples
The following are 30
code examples of hparams.hparams.ref_level_db().
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: stft.py From cnn_vocoder with MIT License | 6 votes |
def forward(self, x): if self.preemp is not None: x = x.unsqueeze(1) x = self.preemp(x) x = x.squeeze(1) stft = torch.stft(x, self.win_length, self.hop_length, fft_size=self.n_fft, window=self.win) real = stft[:, :, :, 0] im = stft[:, :, :, 1] spec = torch.sqrt(torch.pow(real, 2) + torch.pow(im, 2)) # convert linear spec to mel mel = torch.matmul(spec, self.mel_basis) # convert to db mel = _amp_to_db(mel) - hparams.ref_level_db return _normalize(mel)
Example #2
Source File: audio.py From gmvae_tacotron with MIT License | 5 votes |
def inv_mel_spectrogram(mel_spectrogram): '''Converts mel spectrogram to waveform using librosa''' if hparams.signal_normalization: D = _denormalize(mel_spectrogram) else: D = mel_spectrogram S = _mel_to_linear(_db_to_amp(D + hparams.ref_level_db)) # Convert back to linear return _griffin_lim(S ** hparams.power)
Example #3
Source File: audio.py From tacotron with MIT License | 5 votes |
def inv_spectrogram(spectrogram): '''Converts spectrogram to waveform using librosa''' S = _db_to_amp(_denormalize(spectrogram) + hparams.ref_level_db) # Convert back to linear return inv_preemphasis(_griffin_lim(S ** hparams.power)) # Reconstruct phase
Example #4
Source File: audio.py From tacotron with MIT License | 5 votes |
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))
Example #5
Source File: audio.py From tacotron with MIT License | 5 votes |
def melspectrogram(y): D = _stft(preemphasis(y)) S = _amp_to_db(_linear_to_mel(np.abs(D))) - hparams.ref_level_db return _normalize(S)
Example #6
Source File: audio.py From WaveRNN-Pytorch with MIT License | 5 votes |
def spectrogram(y): D = _lws_processor().stft(preemphasis(y)).T S = _amp_to_db(np.abs(D)) - hparams.ref_level_db return _normalize(S)
Example #7
Source File: audio.py From WaveRNN-Pytorch with MIT License | 5 votes |
def inv_spectrogram(spectrogram): '''Converts spectrogram to waveform using librosa''' S = _db_to_amp(_denormalize(spectrogram) + hparams.ref_level_db) # Convert back to linear processor = _lws_processor() D = processor.run_lws(S.astype(np.float64).T ** hparams.power) y = processor.istft(D).astype(np.float32) return inv_preemphasis(y)
Example #8
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 #9
Source File: audio.py From gmvae_tacotron with MIT License | 5 votes |
def linearspectrogram(wav): D = _stft(wav) S = _amp_to_db(np.abs(D)) - hparams.ref_level_db if hparams.signal_normalization: return _normalize(S) return S
Example #10
Source File: audio.py From gmvae_tacotron with MIT License | 5 votes |
def melspectrogram(wav): D = _stft(wav) S = _amp_to_db(_linear_to_mel(np.abs(D))) - hparams.ref_level_db if hparams.signal_normalization: return _normalize(S) return S
Example #11
Source File: audio.py From gmvae_tacotron with MIT License | 5 votes |
def inv_linear_spectrogram(linear_spectrogram): '''Converts linear spectrogram to waveform using librosa''' if hparams.signal_normalization: D = _denormalize(linear_spectrogram) else: D = linear_spectrogram S = _db_to_amp(D + hparams.ref_level_db) #Convert back to linear return _griffin_lim(S ** hparams.power)
Example #12
Source File: audio.py From tacotron with MIT License | 5 votes |
def spectrogram(y): D = _stft(preemphasis(y)) S = _amp_to_db(np.abs(D)) - hparams.ref_level_db return _normalize(S)
Example #13
Source File: audio.py From gmvae_tacotron with MIT License | 5 votes |
def melspectrogram(wav): D = _stft(wav) S = _amp_to_db(_linear_to_mel(np.abs(D))) - hparams.ref_level_db if hparams.mel_normalization: return _normalize(S) return S
Example #14
Source File: audio.py From Tacotron2-PyTorch with MIT License | 5 votes |
def spectrogram(y): D = _stft(preemphasis(y)) S = _amp_to_db(np.abs(D)) - hps.ref_level_db return _normalize(S)
Example #15
Source File: audio.py From Tacotron2-PyTorch with MIT License | 5 votes |
def inv_spectrogram(spectrogram): '''Converts spectrogram to waveform using librosa''' S = _db_to_amp(_denormalize(spectrogram) + hps.ref_level_db) # Convert back to linear return inv_preemphasis(_griffin_lim(S ** hps.power)) # Reconstruct phase
Example #16
Source File: audio.py From Tacotron2-PyTorch with MIT License | 5 votes |
def melspectrogram(y): D = _stft(preemphasis(y)) S = _amp_to_db(_linear_to_mel(np.abs(D))) - hps.ref_level_db return _normalize(S)
Example #17
Source File: audio.py From Tacotron2-PyTorch with MIT License | 5 votes |
def inv_melspectrogram(spectrogram): mel = _db_to_amp(_denormalize(spectrogram) + hps.ref_level_db) S = _mel_to_linear(mel) return inv_preemphasis(_griffin_lim(S ** hps.power))
Example #18
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 #19
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 #20
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 #21
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 #22
Source File: audio.py From vae_tacotron2 with MIT License | 5 votes |
def inv_mel_spectrogram(mel_spectrogram): '''Converts mel spectrogram to waveform using librosa''' if hparams.signal_normalization: D = _denormalize(mel_spectrogram) else: D = mel_spectrogram S = _mel_to_linear(_db_to_amp(D + hparams.ref_level_db)) # Convert back to linear return _griffin_lim(S ** hparams.power)
Example #23
Source File: audio.py From Griffin_lim with MIT License | 5 votes |
def inv_spectrogram(spectrogram): S = _db_to_amp(_denormalize(spectrogram) + hparams.ref_level_db) # Convert back to linear return _inv_preemphasis(_griffin_lim(S ** hparams.power)) # Reconstruct phase
Example #24
Source File: griffin_lim.py From Griffin_lim with MIT License | 5 votes |
def inv_spectrogram(spectrogram): S = _db_to_amp(_denormalize(spectrogram) + hparams.ref_level_db) # Convert back to linear return _inv_preemphasis(spectrogram2wav(S ** hparams.power)) # Reconstruct phase
Example #25
Source File: audio.py From vae_tacotron with MIT License | 5 votes |
def spectrogram(y): D = _stft(preemphasis(y)) S = _amp_to_db(np.abs(D)) - hparams.ref_level_db return _normalize(S)
Example #26
Source File: audio.py From vae_tacotron with MIT License | 5 votes |
def inv_spectrogram(spectrogram): '''Converts spectrogram to waveform using librosa''' S = _db_to_amp(_denormalize(spectrogram) + hparams.ref_level_db) # Convert back to linear return inv_preemphasis(_griffin_lim(S ** hparams.power)) # Reconstruct phase
Example #27
Source File: audio.py From vae_tacotron with MIT License | 5 votes |
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))
Example #28
Source File: audio.py From vae_tacotron with MIT License | 5 votes |
def melspectrogram(y): D = _stft(preemphasis(y)) S = _amp_to_db(_linear_to_mel(np.abs(D))) - hparams.ref_level_db return _normalize(S)
Example #29
Source File: audio.py From vae_tacotron2 with MIT License | 5 votes |
def linearspectrogram(wav): D = _stft(wav) S = _amp_to_db(np.abs(D)) - hparams.ref_level_db if hparams.signal_normalization: return _normalize(S) return S
Example #30
Source File: audio.py From vae_tacotron2 with MIT License | 5 votes |
def melspectrogram(wav): D = _stft(wav) S = _amp_to_db(_linear_to_mel(np.abs(D))) - hparams.ref_level_db if hparams.signal_normalization: return _normalize(S) return S