Skip to content

Commit d2b1ca9

Browse files
authored
Merge pull request prateekiiest#117 from faresbessrour/feature/speech-to-text
Added the Speech To Text module with the Requirements and README.md
2 parents e20e518 + 7af46a3 commit d2b1ca9

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Speech-To-Text
2+
3+
Simple Script to get User input from microphone and use Google's API to transform into text.
4+
5+
# Installation
6+
7+
Install python-pyaudio:
8+
9+
```
10+
sudo apt-get install python-pyaudio
11+
```
12+
13+
Install portaudio:
14+
15+
```
16+
sudo apt-get install portaudio19-dev
17+
```
18+
19+
Sadly, the PyAudio is not updated and doesn't work on the latest version of Python3 so:
20+
21+
```
22+
virtualenv -p python2.7 req
23+
source req/bin/activate
24+
pip install PyAudio
25+
pip install SpeechRecognition
26+
```
27+
28+
# Test the app:
29+
30+
```
31+
source req/bin/activate
32+
python stt.py
33+
```
34+
35+
# TODO:
36+
37+
- Find a way to make this work for Python3.
38+
39+
- Add new recognition APIs.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PyAudio==0.2.11
2+
SpeechRecognition==3.8.1
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import speech_recognition as sr
2+
3+
r = sr.Recognizer()
4+
5+
with sr.Microphone() as source:
6+
print("Say something... ")
7+
audio = r.listen(source)
8+
9+
try:
10+
print("Google thinks you said: {}".format(r.recognize_google(audio)))
11+
except sr.UnkownValueError:
12+
print("Couldn't understand")
13+
except sr.RequestError as e:
14+
print("Couldn't request results; {}".format(e))

0 commit comments

Comments
 (0)