Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Text-to-Speech (TTS) with Tacotron2 trained on a custom german dataset with 12 days voice using speechbrain.
|
2 |
+
|
3 |
+
## How to use
|
4 |
+
Install speechbrain.
|
5 |
+
|
6 |
+
```
|
7 |
+
pip install speechbrain
|
8 |
+
```
|
9 |
+
|
10 |
+
Generate spectrogram (line 17) and generate wav using hifigan (line 18).
|
11 |
+
|
12 |
+
```
|
13 |
+
import torchaudio
|
14 |
+
from speechbrain.pretrained import Tacotron2
|
15 |
+
from speechbrain.pretrained import HIFIGAN
|
16 |
+
|
17 |
+
# Intialize TTS (tacotron2) and Vocoder (HiFIGAN)
|
18 |
+
tacotron2 = Tacotron2.from_hparams(source="padmalcom/tts-tacotron2-german", savedir="tmpdir_tts")
|
19 |
+
hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-ljspeech", savedir="tmpdir_vocoder")
|
20 |
+
|
21 |
+
# Running the TTS
|
22 |
+
mel_output, mel_length, alignment = tacotron2.encode_text("Die Sonne schien den ganzen Tag.")
|
23 |
+
|
24 |
+
# Running Vocoder (spectrogram-to-waveform)
|
25 |
+
waveforms = hifi_gan.decode_batch(mel_output)
|
26 |
+
|
27 |
+
# Save the waverform
|
28 |
+
torchaudio.save('example_TTS.wav',waveforms.squeeze(1), 22050)
|
29 |
+
```
|