Skip to content

Commit

Permalink
Create speech.py
Browse files Browse the repository at this point in the history
  • Loading branch information
abhuman authored Oct 19, 2023
1 parent bfbb53f commit a5a1db1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions snap/speech.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import speech_recognition as sr

# Create a recognizer instance
r = sr.Recognizer()

# Use the default microphone as the audio source
with sr.Microphone() as source:
print("Listening...")
# Read the audio data from the default microphone
audio_data = r.record(source, duration=5)
print("Recognizing...")
# Convert speech to text
text = r.recognize_google(audio_data)
print(text)

0 comments on commit a5a1db1

Please sign in to comment.