Vocoder with HiFIGAN trained on LJSpeech
This repository provides all the necessary tools for using a HiFIGAN vocoder trained with LJSpeech.
The pre-trained model takes in input a spectrogram and produces a waveform in output. Typically, a vocoder is used after a TTS model that converts an input text into a spectrogram.
The sampling frequency is 22050 Hz.
Install SpeechBrain
pip install speechbrain<br />
Please notice that we encourage you to read our tutorials and learn more about
SpeechBrain.
Using the Vocoder
import torch<br /> from speechbrain.pretrained import HIFIGAN<br /> hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-ljspeech", savedir="tmpdir")<br /> mel_specs = torch.rand(2, 80,298)<br /> waveforms = hifi_gan.decode_batch(mel_specs)<br />
Using the Vocoder with the TTS
import torchaudio<br /> from speechbrain.pretrained import Tacotron2<br /> from speechbrain.pretrained import HIFIGAN<br /> # Intialize TTS (tacotron2) and Vocoder (HiFIGAN)<br /> tacotron2 = Tacotron2.from_hparams(source="speechbrain/tts-tacotron2-ljspeech", savedir="tmpdir_tts")<br /> hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-ljspeech", savedir="tmpdir_vocoder")<br /> # Running the TTS<br /> mel_output, mel_length, alignment = tacotron2.encode_text("Mary had a little lamb")<br /> # Running Vocoder (spectrogram-to-waveform)<br /> waveforms = hifi_gan.decode_batch(mel_output)<br /> # Save the waverform<br /> torchaudio.save('example_TTS.wav',waveforms.squeeze(1), 22050)<br />
Inference on GPU
To perform inference on the GPU, add run_opts={"device":"cuda"}
when calling the from_hparams
method.
Training
The model was trained with SpeechBrain.
To train it from scratch follow these steps:
- Clone SpeechBrain:
git clone https://github.com/speechbrain/speechbrain/<br />
- Install it:
cd speechbrain<br /> pip install -r requirements.txt<br /> pip install -e .<br />
- Run Training:
cd recipes/LJSpeech/TTS/vocoder/hifi_gan/<br /> python train.py hparams/train.yaml --data_folder /path/to/LJspeech<br />
You can find our training results (models, logs, etc) here.
收录说明:
1、本网页并非 speechbrain/tts-hifigan-ljspeech 官网网址页面,此页面内容编录于互联网,只作展示之用;2、如果有与 speechbrain/tts-hifigan-ljspeech 相关业务事宜,请访问其网站并获取联系方式;3、本站与 speechbrain/tts-hifigan-ljspeech 无任何关系,对于 speechbrain/tts-hifigan-ljspeech 网站中的信息,请用户谨慎辨识其真伪。4、本站收录 speechbrain/tts-hifigan-ljspeech 时,此站内容访问正常,如遇跳转非法网站,有可能此网站被非法入侵或者已更换新网址,导致旧网址被非法使用,5、如果你是网站站长或者负责人,不想被收录请邮件删除:i-hu#Foxmail.com (#换@)
前往AI网址导航
2、本站所有文章、图片、资源等如果未标明原创,均为收集自互联网公开资源;分享的图片、资源、视频等,出镜模特均为成年女性正常写真内容,版权归原作者所有,仅作为个人学习、研究以及欣赏!如有涉及下载请24小时内删除;
3、如果您发现本站上有侵犯您的权益的作品,请与我们取得联系,我们会及时修改、删除并致以最深的歉意。邮箱: i-hu#(#换@)foxmail.com