Skip to content

Commit 1195763

Browse files
authored
Merge pull request prateekiiest#116 from faresbessrour/feature/text-to-speech
Feature/text to speech
2 parents e43fd47 + a1527fc commit 1195763

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

Code-Sleep-Python/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore all req folders inside the projects
2+
*/req
3+
4+
# Text-To-Speech
5+
text-to-speech/speech.mp3
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Text-To-Speech
2+
3+
This code uses the gtts library to read a textinput and create an mp3 file. Very simple but very cool.
4+
5+
Create a virtualenv using python3 and install the requirements with:
6+
7+
```
8+
virtualenv -p python3 req
9+
source req/bin/activate
10+
pip install -r requirements.txt
11+
```
12+
13+
To run the app just do:
14+
```
15+
python tts.py
16+
```
17+
18+
For the first version the text is just hard coded inside the file but next step is to make the app take an optional input like:
19+
20+
```
21+
python tts.py -t "Some random text that we want in an mp3 file"
22+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
beautifulsoup4==4.6.0
2+
bs4==0.0.1
3+
certifi==2018.4.16
4+
chardet==3.0.4
5+
click==6.7
6+
gTTS==2.0.0
7+
gTTS-token==1.1.1
8+
idna==2.6
9+
requests==2.18.4
10+
six==1.11.0
11+
urllib3==1.22
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from gtts import gTTS
2+
3+
text = ("Hello world!")
4+
tts = gTTS(text=text, lang='en')
5+
tts.save("speech.mp3")

0 commit comments

Comments
 (0)