Skip to content

Commit

Permalink
Update meldataset.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenye234 committed Dec 13, 2023
1 parent aa8ffbc commit cdb60f0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion hifi-gan/meldataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@

MAX_WAV_VALUE = 32768.0

spec_min=-12
spec_max=2
def norm_spec( x):
return (x - spec_min) / ( spec_max - spec_min) * 2 - 1
def denorm_spec( x):
return (x + 1) / 2 * ( spec_max - spec_min) + spec_min


def load_wav(full_path):
sampling_rate, data = read(full_path)
Expand Down Expand Up @@ -70,7 +77,8 @@ def mel_spectrogram(y, n_fft, num_mels, sampling_rate, hop_size, win_size, fmin,

spec = torch.matmul(mel_basis[str(fmax)+'_'+str(y.device)], spec)
spec = spectral_normalize_torch(spec)

# if como_zero
# spec = norm_spec(spec)
return spec


Expand Down

0 comments on commit cdb60f0

Please sign in to comment.