python speech recognition
The best library because you dont have to save the
text file or open the file to start the speech
pip install pyttsx3
import pyttsx3
engine = pyttsx3.init()
engine.say("Hello world")
engine.runAndWait()
0
8
import speech_recognition as sr
def main():
r = sr.Recognizer()
with sr.Microphone() as source:
r.adjust_for_ambient_noise(source)
audio = r.listen(source)
try:
print(r.recognize_google(audio))
except Exception as e:
print("Error : " + str(e))
with open("recorded.wav", "wb") as f:
f.write(audio.get_wav_data())
if __name__ == "__main__":
main()
Thank you!
8
0
3
1
import cv2
import pytesseract
img = cv2.imread('image.jpg')
# Adding custom options
custom_config = r'--oem 3 --psm 6'
pytesseract.image_to_string(img, config=custom_config)
Thank you!
1
0
3.5
6
#pip install SpeechRecognition
#in case of error use 'pip install pyaudio' or...
#in case of error use 'pip install pipwin' then 'pipwin install pyaudio'
#if error continued you may need to use python 3.6 or lower as the latest
#python may not support pyaudio...
import speech_recognition as sr
import pyttsx3
#audio of system to respond
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
engine.setProperty('rate',180)
def speak(audio):
engine.say(audio)
engine.runAndWait()
# simple function to recognise speech from user
def takecommand():
#it takes microphone input and returns string output
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening.....')
r.pause_threshold = 1
r.energy_threshold = 4000
audio = r.listen(source)
try:
print('Recognising...')
query = r.recognize_google(audio, language='en-in')
print('User Said : ' , query)
except Exception as e:
print('exception : ',e)
speak("Sorry, I didn't hear that, Say that again Please")
return "None"
return query
while True:
query = takecommand() # whatever user says will be stored in this variable
print("The Test got in program is : "+query)
Thank you!
6
0
4.38
8
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
8
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
0
0
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Listening...')
r.pause_threshold = 1
r.energy_threshold = 50
audio = r.listen(source)
try:
print('Recognizing...')
qry = r.recognize_google(audio, language='en-in')
print(f"user said: {qry}\n")
# if any error occurs this line will run
except Exeption as e:
# if you don't want to print the error comment the bottom line
print(e)
print('Say that again please\n')
return 'None'
return qry
if __name__ == '__main__':
while True:
qry = takecommand().lower()
# now you can use the takecommand function where you want to recognize speech
# And please experiment with the above code
# like what pause_threshold and energy_threshold do
/\/\/\/\/\/\/\/\/\/\/\--- *HAPPYCODING* ---/\/\/\/\/\/\/\/\/\/\/\
Thank you!
0
0
4.2
5
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source: # use the default microphone as the audio source
audio = r.listen(source) # listen for the first phrase and extract it into audio data
try:
print("You said " + r.recognize(audio)) # recognize speech using Google Speech Recognition
except LookupError: # speech is unintelligible
print("Could not understand audio")
Thank you!
5
0
0
0
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source: # use the default microphone as the audio source
audio = r.listen(source) # listen for the first phrase and extract it into audio data
try:
print("You said " + r.recognize(audio)) # recognize speech using Google Speech Recognition
except LookupError: # speech is unintelligible
print("Could not understand audio")
Thank you!
0
0
0
0
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source: # use the default microphone as the audio source
audio = r.listen(source) # listen for the first phrase and extract it into audio data
try:
print("You said " + r.recognize(audio)) # recognize speech using Google Speech Recognition
except LookupError: # speech is unintelligible
print("Could not understand audio")
Thank you!
0
0
0
0
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source: # use the default microphone as the audio source
audio = r.listen(source) # listen for the first phrase and extract it into audio data
try:
print("You said " + r.recognize(audio)) # recognize speech using Google Speech Recognition
except LookupError: # speech is unintelligible
print("Could not understand audio")
Thank you!
0
0
0
0
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source: # use the default microphone as the audio source
audio = r.listen(source) # listen for the first phrase and extract it into audio data
try:
print("You said " + r.recognize(audio)) # recognize speech using Google Speech Recognition
except LookupError: # speech is unintelligible
print("Could not understand audio")
Thank you!
0
0
0
0
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source: # use the default microphone as the audio source
audio = r.listen(source) # listen for the first phrase and extract it into audio data
try:
print("You said " + r.recognize(audio)) # recognize speech using Google Speech Recognition
except LookupError: # speech is unintelligible
print("Could not understand audio")
Thank you!
0
0
Are there any code examples left?
New code examples in category Python