Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How use the torchaudio.tansforms.Melspectrogram to replace the mel_spectrogram function in meldataset.py? #170

Open
liyihao17 opened this issue Nov 19, 2024 · 2 comments

Comments

@liyihao17
Copy link

I tried to replace the mel_spectrogram function by torchaudio.tansforms.Melspectrogram, but the output of these two function is difference, which lead to the failure of transforming the log mel spectrogram to wave file.

@liyihao17
Copy link
Author

I set the mel_spectorgram function like :
mel = mel_spectrogram(wav, n_fft=1024, num_mels=80, sampling_rate=16000, hop_size=256, win_size=1024, fmin=0, fmax=8000)

and set the torchaudio class like :
torchaudio.transforms.MelSpectrogram(sample_rate=16000, n_fft=1024, hop_length=256, f_min=0, f_max=8000, n_mels=80, win_length=1024, window_fn=torch.hann_window, center=False, onesided=True)
mel = torch.log(torch.clamp(mel, min=1e-10))

this two function cannot output the same mel spectorgram

@sophiefy
Copy link

Seems that the mel filter banks in librosa and torchaudio are a bit different, resulting in different mel-spectrogram.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants