feat: first commit (it kinda works)

This commit is contained in:
2023-04-15 16:16:01 +02:00
parent 0a0e3ed2a9
commit e6b15cdc55
12 changed files with 2200 additions and 0 deletions

21
python/stt.py Normal file
View File

@@ -0,0 +1,21 @@
import speech_recognition as sr
import os
os.environ['PYALSA_DEBUG'] = '0'
# Initialize recognizer
r = sr.Recognizer()
# Use the default microphone as the audio source
with sr.Microphone() as source:
print("Speak something...")
audio = r.listen(source, phrase_time_limit = 2)
try:
# Use Google Speech Recognition to transcribe the audio
text = r.recognize_google(audio)
print(text)
except sr.UnknownValueError:
print("SpeechToTextError")
except sr.RequestError:
print("SpeechToTextError")