Skip to content

Commit 542997b

Browse files
authored
Merge pull request #136 from vamsikrishnarh7/main
Speech to Text App
2 parents 8d68893 + cadea21 commit 542997b

File tree

6 files changed

+76
-0
lines changed

6 files changed

+76
-0
lines changed

Speech to Text App/images/readme.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lorem ipsum
168 KB
Loading
175 KB
Loading

Speech to Text App/main.py

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from tkinter import *
2+
import speech_recognition as aa
3+
import pyttsx3
4+
5+
root = Tk()
6+
root.title('Speech to Text')
7+
root.geometry('500x500')
8+
9+
def action():
10+
status['text'] = "Listening..."
11+
listener = aa.Recognizer()
12+
13+
# check microphone is working or not
14+
try :
15+
#using microphone
16+
with aa.Microphone() as origin:
17+
# speech_output['text'] = "Listening"
18+
print("Listening...")
19+
speech = listener.listen(origin)
20+
#recognise the voice and convert into text
21+
instruction = listener.recognize_google(speech)
22+
except :
23+
pass
24+
25+
status['text'] = " "
26+
speech_output['text'] = instruction
27+
28+
label = Label(root, text="Speech to Text Converter",font=("Arial", 20) )
29+
label.pack()
30+
status = Label(root, text=" ", font=("Arial", 10))
31+
status.pack()
32+
button = Button(root, text="Talk", command=action, font=("Arial", 12))
33+
button.pack()
34+
speech_output = Label(text="", font=("Arial", 16))
35+
speech_output.pack()
36+
37+
38+
root.mainloop()

Speech to Text App/readme.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Speech to Text App
2+
3+
This is done with the help of Google Speech Recognition.
4+
*This requires an active internet connection to work*. However, there are certain offline Recognition systems such as PocketSphinx,
5+
but have a very rigorous installation process that requires several dependencies. Google Speech Recognition is one of the easiest to use.
6+
7+
## Insatllation Required
8+
- Python speech recognition module
9+
10+
```pip install speechrecognition```
11+
- Python pyttsx3 module:
12+
13+
```pip install pyttsx3```
14+
15+
## Approach
16+
17+
This app build using `tkinter 3.9.14`, `speechrecognition` and `pyttsx3`.
18+
- Import the `tkinter`, `speechrecognition` and `pyttsx3` modules.
19+
- initiate `Recognizer()`
20+
- access microphone using `Microphone()` and use `listen()` to listen what you are saying
21+
- convert the speech to text using `recognize_google()` by passing the speech that is collected using `listen()`
22+
23+
## Demonstration
24+
25+
26+
27+
https://user-images.githubusercontent.com/89008784/209456864-90e11a0c-f7f7-4356-97ac-55aae59a46bd.mp4
28+
29+
30+
31+
[**Durga Vamsi Krishna**](https://github.com/vamsikrishnarh7/)

Speech to Text App/requirements.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The required library is:
2+
3+
tkinter
4+
SpeechRecognition
5+
pyttsx3
6+

0 commit comments

Comments
 (0)