Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions projects/Speech to text/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PyAudio==0.2.11
SpeechRecognition==3.8.1
23 changes: 23 additions & 0 deletions projects/Speech to text/speech_to_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import speech_recognition

def record_voice():
microphone = speech_recognition.Recognizer()

with speech_recognition.Microphone() as live_phone:
microphone.adjust_for_ambient_noise(live_phone)

print("I'm trying to hear you: ")
audio = microphone.listen(live_phone)
try:
phrase = microphone.recognize_google(audio, language='en')
return phrase
except speech_recognition.UnkownValueError:
return "I didn't understand what you said"

if __name__ == '__main__':
phrase = record_voice()

with open('you_said_this.txt','w') as file:
file.write(phrase)

print('the last sentence you spoke was saved in you_said_this.txt')