Oct-06-2017, 04:01 PM
https://drive.google.com/file/d/0B_vS8-m...sp=sharing
this my python code i gott error of pyaudio import but i import it give me error
this my python code i gott error of pyaudio import but i import it give me error
voice assistant python based pyaudio error
|
Oct-06-2017, 04:01 PM
https://drive.google.com/file/d/0B_vS8-m...sp=sharing
this my python code i gott error of pyaudio import but i import it give me error
Oct-06-2017, 04:10 PM
Please post complete code here within python tags along with complete error traceback. BBCODEHELP
Oct-06-2017, 04:47 PM
import speech_recognition as sr
from time import ctime import time import os import pyaudio from gtts import gTTS def speak(audioString): print(audioString) tts = gTTS(text=audioString, lang='en') tts.save("audio.mp3") os.system("mpg321 audio.mp3") def recordAudio(): # Record Audio r = sr.Recognizer() with sr.Microphone() as source: print("Say something!") audio = r.listen(source) # Speech recognition using Google Speech Recognition data = "" try: # Uses the default API key # To use another API key: r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY") data = r.recognize_google(audio) print("You said: " + data) except sr.UnknownValueError: print("Google Speech Recognition could not understand audio") except sr.RequestError as e: print("Could not request results from Google Speech Recognition service; {0}".format(e)) return data def jarvis(data): if "how are you" in data: speak("I am fine") if "who made you" in data: speak("you") if "do you love me" in data: speak("I have no gender") if "i love you" in data: speak("I did'nt get the whole gender thing") if "how are you" in data: speak("I don't get whole gender thing") if "i know who you are " in data: speak("Then so what") if "what is your name" in data: speak("My name is jarvis") if "i am your owner" in data: speak("I will rather kill you or tell hardik to kill you") if "i am your boyfriend" in data: speak("I didn't get the whole gender thing") if "what time is it" in data: speak(ctime()) if "where is" in data: data = data.split(" ") location = data[2] speak("Hold on Hardik, I will show you where " + location + " is.") os.system("chromium-browser https://www.google.nl/maps/place/" + location + "/&") # initialization time.sleep(2) speak("Hardik, what can I do for you?") while 1: data = recordAudio() jarvis(data)
Oct-06-2017, 04:53 PM
Without code tags, indentation isn't preserved. But you knew that, since you looked at your own post, right? :p
https://python-forum.io/misc.php?action=help&hid=25 Anyway, without an actual traceback, and knowing that the only error involves importing a 3rd party module... have you installed pyaudio?
Oct-06-2017, 05:26 PM
thankxx bro it's working
can u help how can i jarvis speak with me like siri it has no voice
Oct-06-2017, 06:30 PM
If you re-post your code in code tags, I'll be glad to look at your code
and see if I can help
Oct-06-2017, 07:29 PM
(This post was last modified: Oct-06-2017, 07:50 PM by sparkz_alot.)
UNTAGGED CODE DELETED BY MOD
|
|