-
Notifications
You must be signed in to change notification settings - Fork 0
/
PKG-INFO
154 lines (126 loc) · 5.16 KB
/
PKG-INFO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
Metadata-Version: 1.1
Name: gTTS
Version: 1.1.8
Summary: Create an mp3 file from spoken text via the Google TTS (Text-to-Speech) API
Home-page: https://github.com/pndurette/gTTS
Author: Pierre Nicolas Durette
Author-email: [email protected]
License: MIT
Description: #gTTS
**gTTS** (_Google Text to Speech_): a *Python* interface for Google's _Text to Speech_ API. Create an _mp3_ file with the `gTTS` module or `gtts-cli` command line utility. It allows unlimited lengths to be spoken by tokenizing long sentences where the speech would naturally pause.
[![Build Status](https://travis-ci.org/pndurette/gTTS.svg?branch=master)](https://travis-ci.org/pndurette/gTTS)
## Install
pip install gTTS
## Usage
You may either use `gTTS` as a **__python module__** or as a **__command-line utility__**
### A. Module
##### 1. Import `gTTS`
```
>> from gtts import gTTS
```
##### 2. Create an instance
```
>> tts = gTTS(text='Hello', lang='en')
```
###### _Parameters:_
* `text` - Text to be spoken (written to file instead)
* `lang` - [ISO 639-1 language code](#lang_list) (supported by the Google _Text to Speech_ API) to speak in
##### 3. Write to a file
* Using [`save(file_name)`](https://github.com/pndurette/gTTS/blob/master/gtts/tts.py#L91)
```
>> tts.save("hello.mp3")
```
* Using [`write_to_fp(file_object)`](https://github.com/pndurette/gTTS/blob/master/gtts/tts.py#L97)
```
>> from gtts import gTTS
>> from tempfile import TemporaryFile
>> tts = gTTS(text='Hello', lang='en')
>> f = TemporaryFile()
>> tts.write_to_fp(f)
>> f.close()
```
### B. Command line utility
##### Command
```
gtts-cli.py [-h] (["text to speak"] | -f FILE) [-l LANG] [--debug] [-o destination_file]
```
###### _Example:_
```
$ # Read the string 'Hello' in English to hello.mp3
$ gtts-cli.py "Hello" -l 'en' -o hello.mp3
$ # Read the contents of file 'hello.txt' in Czech to hello.mp3:
$ gtts-cli.py -f hello.txt -l 'cs' -o hello.mp3
$ # Read the string 'Hello' from stdin in English to hello.mp3
$ echo "Hello" | gtts-cli.py -l 'en' -o hello.mp3 -
```
##Supported Languages<a name="lang_list"></a>
* 'af' : 'Afrikaans'
* 'sq' : 'Albanian'
* 'ar' : 'Arabic'
* 'hy' : 'Armenian'
* 'bn' : 'Bengali'
* 'ca' : 'Catalan'
* 'zh' : 'Chinese'
* 'zh-cn' : 'Chinese (Mandarin/China)'
* 'zh-tw' : 'Chinese (Mandarin/Taiwan)'
* 'zh-yue' : 'Chinese (Cantonese)'
* 'hr' : 'Croatian'
* 'cs' : 'Czech'
* 'da' : 'Danish'
* 'nl' : 'Dutch'
* 'en' : 'English'
* 'en-au' : 'English (Australia)'
* 'en-uk' : 'English (United Kingdom)'
* 'en-us' : 'English (United States)'
* 'eo' : 'Esperanto'
* 'fi' : 'Finnish'
* 'fr' : 'French'
* 'de' : 'German'
* 'el' : 'Greek'
* 'hi' : 'Hindi'
* 'hu' : 'Hungarian'
* 'is' : 'Icelandic'
* 'id' : 'Indonesian'
* 'it' : 'Italian'
* 'ja' : 'Japanese'
* 'ko' : 'Korean'
* 'la' : 'Latin'
* 'lv' : 'Latvian'
* 'mk' : 'Macedonian'
* 'no' : 'Norwegian'
* 'pl' : 'Polish'
* 'pt' : 'Portuguese'
* 'pt-br' : 'Portuguese (Brazil)'
* 'ro' : 'Romanian'
* 'ru' : 'Russian'
* 'sr' : 'Serbian'
* 'sk' : 'Slovak'
* 'es' : 'Spanish'
* 'es-es' : 'Spanish (Spain)'
* 'es-us' : 'Spanish (United States)'
* 'sw' : 'Swahili'
* 'sv' : 'Swedish'
* 'ta' : 'Tamil'
* 'th' : 'Thai'
* 'tr' : 'Turkish'
* 'vi' : 'Vietnamese'
* 'cy' : 'Welsh'
Contributing
------------
1. _Fork_ [pndurette/gTTS](https://github.com/pndurette/gTTS) on GitHub and clone it locally
2. Make sure you write tests for new features or modify the existing ones if necessary
3. Open a new _Pull Request_ from your feature branch to the `develop` branch.
4. Thank you!
Platform: UNKNOWN
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Unix
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech