acul3 commited on
Commit
8ebfba7
·
verified ·
1 Parent(s): 9e62736

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +103 -0
README.md ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ language:
4
+ - id
5
+ ---
6
+
7
+ # Indonesian TTS Documentation
8
+
9
+ This documentation provides a step-by-step guide on setting up and using the Indonesian Text-to-Speech (TTS) system based on a pretrained model. The instructions cover downloading necessary files, installing required packages, and running a script to synthesize speech from text.
10
+
11
+ ## Prerequisites
12
+
13
+ Ensure you have `wget`, `pip`, and `pip3` installed on your system.
14
+
15
+ ## Steps
16
+
17
+ ### 1. Download the Pretrained Model and Configuration Files
18
+
19
+ Use the following commands to download the necessary files:
20
+
21
+ ```bash
22
+ Download from this https://huggingface.co/Bahasalab/TTS/upload/main
23
+ ```
24
+
25
+ ### 2. Install Required Packages
26
+
27
+ Install the TTS library and the Indonesian Grapheme-to-Phoneme (G2P) converter:
28
+
29
+ ```bash
30
+ !pip install TTS
31
+ !pip3 install -U git+https://github.com/acul3/g2p-id
32
+ ```
33
+
34
+ ### 3. Import Libraries
35
+
36
+ Import the necessary libraries for TTS and G2P:
37
+
38
+ ```python
39
+ from TTS.api import TTS
40
+ import torch
41
+ from TTS.utils.synthesizer import Synthesizer
42
+ from g2p_id import G2P
43
+ ```
44
+
45
+ ### 4. Check Device
46
+
47
+ Check if a GPU is available and set the device accordingly:
48
+
49
+ ```python
50
+ device = "cuda" if torch.cuda.is_available() else "cpu"
51
+ ```
52
+
53
+ ### 5. Initialize G2P
54
+
55
+ Initialize the Indonesian G2P converter:
56
+
57
+ ```python
58
+ g2p = G2P()
59
+ ```
60
+
61
+ ### 6. Prepare Text
62
+
63
+ Convert the input text to phonemes:
64
+
65
+ ```python
66
+ text = g2p("progress nya baru sampai sini, belum bisa real time baru sekitar dua detik buat generate nya, harus butuh data lebih banyak, sekitar dua kali lebih banyak,")
67
+ ```
68
+
69
+ ### 7. Initialize Synthesizer
70
+
71
+ Initialize the TTS synthesizer with the downloaded checkpoint and configuration files:
72
+
73
+ ```python
74
+ synthesizer = Synthesizer(
75
+ tts_checkpoint="checkpoint_1260000-inference.pth",
76
+ tts_config_path="config.json",
77
+ tts_speakers_file="speakers.pth"
78
+ ).to(device)
79
+ ```
80
+
81
+ ### 8. Synthesize Speech
82
+
83
+ Generate the speech audio from the text:
84
+
85
+ ```python
86
+ wav = synthesizer.tts(text, speaker_name="wibowo")
87
+ ```
88
+
89
+ ### 9. Save the Audio File
90
+
91
+ Save the generated audio to a file:
92
+
93
+ ```python
94
+ synthesizer.save_wav(wav, "wibowo.wav")
95
+ ```
96
+
97
+ ## Notes
98
+
99
+ - Ensure the paths to the checkpoint, config, and speakers files are correctly specified.
100
+ - Adjust the `speaker_name` parameter based on the available speakers in the `speakers.pth` file.
101
+ - The synthesized audio will be saved as `wibowo.wav` in the specified directory.
102
+
103
+ This completes the setup and usage guide for the Indonesian TTS system. For further customization and usage, refer to the official documentation of the TTS library and the G2P converter.