tune visidata functions and add speech.py

This commit is contained in:
TKE
2021-03-09 19:13:39 +01:00
parent ef914572e4
commit 1a5e18444b
2 changed files with 35 additions and 4 deletions

26
speech.py Normal file
View File

@@ -0,0 +1,26 @@
import speech_recognition as sr
recognizer = sr.Recognizer()
''' recording the sound '''
with sr.Microphone() as source:
print("Adjusting noise ")
recognizer.adjust_for_ambient_noise(source, duration=1)
print("Recording for 4 seconds")
recorded_audio = recognizer.listen(source, timeout=4)
print("Done recording")
''' Recorgnizing the Audio '''
try:
print("Recognizing the text")
text = recognizer.recognize_sphinx(
recorded_audio,
language="de-DE"
)
print("Decoded Text : {}".format(text))
except Exception as ex:
print(ex)