Commit
·
965bd51
1
Parent(s):
43b445f
Update README.md
Browse files
README.md
CHANGED
@@ -37,25 +37,11 @@ import torch
|
|
37 |
from speechbrain.pretrained import HIFIGAN
|
38 |
hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-libritts-16kHz", savedir="tmpdir")
|
39 |
mel_specs = torch.rand(2, 80,298)
|
40 |
-
waveforms = hifi_gan.decode_batch(mel_specs)
|
41 |
-
```
|
42 |
-
### Using the Vocoder with the TTS
|
43 |
-
```python
|
44 |
-
import torchaudio
|
45 |
-
from speechbrain.pretrained import Tacotron2
|
46 |
-
from speechbrain.pretrained import HIFIGAN
|
47 |
-
|
48 |
-
# Intialize TTS (tacotron2) and Vocoder (HiFIGAN)
|
49 |
-
tacotron2 = Tacotron2.from_hparams(source="speechbrain/tts-tacotron2-ljspeech", savedir="tmpdir_tts")
|
50 |
-
hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-libritts-16kHz", savedir="tmpdir_vocoder")
|
51 |
-
|
52 |
-
# Running the TTS
|
53 |
-
mel_output, mel_length, alignment = tacotron2.encode_text("Mary had a little lamb")
|
54 |
|
55 |
# Running Vocoder (spectrogram-to-waveform)
|
56 |
-
waveforms = hifi_gan.decode_batch(
|
57 |
|
58 |
-
# Save the
|
59 |
torchaudio.save('example_TTS.wav',waveforms.squeeze(1), 16000)
|
60 |
```
|
61 |
|
|
|
37 |
from speechbrain.pretrained import HIFIGAN
|
38 |
hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-libritts-16kHz", savedir="tmpdir")
|
39 |
mel_specs = torch.rand(2, 80,298)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
# Running Vocoder (spectrogram-to-waveform)
|
42 |
+
waveforms = hifi_gan.decode_batch(mel_specs)
|
43 |
|
44 |
+
# Save the waveform
|
45 |
torchaudio.save('example_TTS.wav',waveforms.squeeze(1), 16000)
|
46 |
```
|
47 |
|