Don't Buy Alexa! Build Your Own. Create a Virtual Assistant with Python | Python Project | Jarvis AI
Why Stack Overflow recommends it
Stack Overflow users link it as the source tutorial when their copy of the voice assistant code fails with speech recognition errors, unbound variables or silent listening.
Recommended by 0 people across 0 different months, 2021 to 2023.
What it is
A 31-minute Python project video from Programming Hero that builds a simple Alexa-style voice assistant in about 20 lines of code. It uses speech_recognition for listening, pyttsx3 for spoken replies, and pywhatkit, wikipedia and pyjokes to play songs, look things up and tell jokes.
What people said
Cites geekora · 2021-01 · Stack Overflow · on “Why is my Python Speech to text code not printing the text when I run it?”
My code is given below. It only outputs listening... and works indefinitely whereas it should be printing what I say to it. I am not sure what's going wrong. I am using windows 10 and the pycharm IDE. I have successfully installed speechRecognition and Pyaudio before running the code. I have also tried recording myself from the voice recorder app in windows and I can record and hear myself clearly. import speech_recognition as sr listener = sr.Recognizer() try: with sr.Microphone() as source: print('listening...') voice = listener.listen(source) command = listener.recognize_google(voice) print(command) except: print('speech not recognized') pass Code taken from [this video] EDIT: Looking for an a
Cites geekora · 2021-01 · Stack Overflow · on “Why is my Python Speech to text code not printing the text when I run it?”
Thank you so much! I am now able to see the text which I speak. But how can we achieve this - When I run the program, it listens to me until I stop speaking / after a certain time and then prints the speech to text while the program is running and then the program ends automatically The person in the video above ( [this video] ) at timestamp 5:42 was able to do it without the indentation but that doesn't work for me. Seems like it worked for others as they mentioned in the comments section.
Cites geekora · 2021-01 · Stack Overflow · on “Why is my Python Speech to text code not printing the text when I run it?”
I am happy to mark your answer as accepted answer if I can get the desired result as shown in the video ( [this video] ) at 5:42
Cites Saumya · 2021-03 · Stack Overflow · on “Python Unbound error in return statement of a function”
I am trying to build an Ai assistant similar to Alexa from this tutorial [this video] . So, I was getting this error and I can't seem to debug it: line 31, in take_command : return command : UnboundLocalError: local variable 'command' referenced before assignment I know this question has been asked a ton of times but I can't seem to understand the solutions, I've read plenty of articles about an unbound error I know it's an issue of global and local scopes but again the same same thing I can't understand those properly... Here's my code: import speech_recognition as sr import pyttsx3 import pywhatkit import datetime import wikipedia import pyjokes listener = sr.Recognizer() engine = pyttsx3.init(
Cites NadraQ__ · 2021-07 · Stack Overflow · on “Virtual Assistant Program: Python Unable to Find Variable”
Basically, the program is a virtual assistant made to take in audio input and transform it into text/string input, which will be stored in the variable 'command'. This is so that the program can then check if certain keywords exist in 'command' and return appropriate responses. (e.g., if command is 'assistant, tell me the time', program will output 'Current time is 3:40 pm') Here is the code: import speech_recognition as sr import pyttsx3 import pywhatkit import datetime import wikipedia import pyjokes listener = sr.Recognizer() engine = pyttsx3.init() voices = engine.getProperty('voices') engine.setProperty('voice', voices[1].id) def talk(text): engine.say(text) engine.runAndWait() def take
Cites JR16CS · 2023-01 · Stack Overflow · on “Speech Recognition module not working, despite being downloaded”
I was following along a tutorial [this video] where they used the SpeechRecognition module, but when I made it to the first test [this video] it returns C:\Users\USER\PycharmProjects\Fatawi\venv\Scripts\python.exe C:/Users/USER/PycharmProjects/Fatawi/main.py Traceback (most recent call last): File "C:\Users\USER\PycharmProjects\Fatawi\main.py", line 1, in <module> import speech_recognition as sr ModuleNotFoundError: No module named 'speech_recognition' I've tried reinstalling the library multiple times along with the PyAudio library. I ran the test that PyPi has for it and it works, but I don't know how fix it from here.