Skip to content

Commit 449db29

Browse files
committed
turn voice into text using speech_recognition
1 parent 98179c1 commit 449db29

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import speech_recognition
2+
3+
rec = speech_recognition.Recognizer()
4+
while True:
5+
with speech_recognition.Microphone() as mic:
6+
print('say somthing ...')
7+
audio = rec.listen(mic)
8+
mic_audio = rec.recognize_google(audio) # write text from mic
9+
print(mic_audio)
10+
text = rec.recognize_google(audio)
11+
if 'hello' in text:
12+
print('Hello OSAMA')

0 commit comments

Comments
 (0)