We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 72f02fb commit 5090465Copy full SHA for 5090465
Speech To Text/main.py
@@ -0,0 +1,22 @@
1
+import speech_recognition
2
+
3
+def record_voice():
4
+ microphone = speech_recognition.Recognizer()
5
6
+ with speech_recognition.Microphone() as live_phone:
7
+ microphone.adjust_for_ambient_noise(live_phone)
8
+ print("I'm trying to hear you: ")
9
+ audio = microphone.listen(live_phone)
10
+ try:
11
+ phrase = microphone.recognize_google(audio, language='en')
12
+ return phrase
13
+ except speech_recognition.UnkownValueError:
14
+ return "I didn't understand what you said"
15
16
+if __name__ == '__main__':
17
+ phrase = record_voice()
18
19
+ with open('you_said_this.txt','w') as file:
20
+ file.write(phrase)
21
22
+ print('The last sentence you spoke was saved in you_said_this.txt')
0 commit comments