Voice Assistant using python 2021|Virtual Voice Assistant in Python |Python projects 2021
As we know Python is a suitable language for scriptwriters and
developers. Let’s write a script for Voice Assistant using Python. The
query for the assistant can be manipulated as per the user’s need.
Speech recognition is the process of converting audio into text. This is commonly used in voice assistants like Alexa, Siri, etc. Python provides an API called SpeechRecognition to allow us to convert audio into text for further processing. In this article, we will look at converting large or long audio files into text using the SpeechRecognition API in python.
Speech recognition is the process of converting audio into text. This is commonly used in voice assistants like Alexa, Siri, etc. Python provides an API called SpeechRecognition to allow us to convert audio into text for further processing. In this article, we will look at converting large or long audio files into text using the SpeechRecognition API in python.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | import speech_recognition as sr import yagmail import speech_recognition as sr import wikipedia import pyttsx3 engine=pyttsx3.init() recognizer=sr.Recognizer() with sr.Microphone() as source: print('Clearing background noise..') print('Clearing background noise...Please wait') recognizer.adjust_for_ambient_noise(source,duration=1) print("waiting for your message...") recordedaudio=recognizer.listen(source) print('Done recording..!') print('Done recording') try: print('Printing the message..') print('Printing your message...Please wait') text=recognizer.recognize_google(recordedaudio,language='en-US') print('Your message:{}'.format(text)) print('Your Message:{}',format(text)) except Exception as ex: print(ex) #Automate mails: reciever='queriesakpython@yahoo.com' message=text sender=yagmail.SMTP('atest0684@gmail.com') sender.send(to=reciever,subject='This is an automated mail',contents=message) #Input data wikisearch=wikipedia.summary(text) engine.say(wikisearch) engine.runAndWait() |
Tags:
voice assistant