Please help; how to import pyttsx3, speech recognition, pyaudio? ; please help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please help; how to import pyttsx3, speech recognition, pyaudio? ; please help

Code - import webbrowser import pyttsx3 as ps import pyaudio as pr import speech_recognition as sr engine = ps.init() r = sr.Recognizer() r.energy_threshold = 400 rate = engine.getProperty('rate') volume = engine.getProperty('volume') engine.setProperty('voices', 3.0) engine.setProperty('rate', 115) with sr.Microphone() as source: try: print("Listening") audio = r.listen(source) data = r.recognize_google(audio) voicedata = data except: engine.say("Voice Error fourzerosix, try restarting the app") print("Voice Error 406, Try restarting the app") engine.runAndWait() print(voicedata) if voicedata == "open Google": engine.say("opening google") engine.runAndWait() webbrowser.open('google.com') if voicedata == "open YouTube": engine.say("opening youtube") engine.runAndWait() webbrowser.open('youtube.com') if voicedata == "open Yahoo.com"or"open yahoo": engine.say("opening yahoo.com") engine.runAndWait() webbrow

21st Apr 2021, 6:47 AM
Krish Rathor
Krish Rathor - avatar
3 Answers
0
The code is truncated because question body is of limited size. Please use code playground to solve this and many other problems.
21st Apr 2021, 2:21 PM
Wilbur Jaywright
Wilbur Jaywright - avatar
0
Hello Wilbur, this specific code is working on Pycharm Ide and my question is how to install python packages in sololearn if all the packages are installed properly I hope my code will work well.
21st Apr 2021, 2:59 PM
Krish Rathor
Krish Rathor - avatar
0
OK, that makes more sense. However, that question has been asked in other places. Apparently, though, you can use the os module to install packages within the SoloLearn sandbox.
21st Apr 2021, 3:00 PM
Wilbur Jaywright
Wilbur Jaywright - avatar