Forum Thread: Python Script for talking with Your Jarvis..

Hello to all learners and aspiring hackers around the globe. I have been following null byte for quite a long time and thought of posting my 1st article for programming .

Step 1: Python as a Guardian for Your Machine to Speak

python is language for hackers and coders and that's for sure.. i have been messing up with python and its really an interesting language to start as well as end with.Python generally popular cuz of the modules and library support that it provides,which makes it a very easy and powerful language. Without wasting time ,lets begin:-

Step 2: Do's Before Coding Your Own Jarvis in Python:-

1) First download and install python coding environment like :- enthought canopy or so , you can choose any dosnt matter.

2) import speech recognizer (pip install command)
3) import pyttsx
4) import pyaudio
5) import PocketSphinx
if some of them are present then make sure to update them
by pip install -U (command_name)

Step 3: The SOURCE CODE :-

import speech_recognition
import pyttsx

speech_engine = pyttsx.init('sapi5') # see http://pyttsx.readthedocs.org/en/latest/engine.html#pyttsx.init
speech_engine.setProperty('rate', (150))

def speak(text):
speech_engine.say(text)
speech_engine.runAndWait()

recognizer = speech_recognition.Recognizer()

def listen():
with speech_recognition.Microphone() as source:
recognizer.adjustforambient_noise(source)
audio = recognizer.listen(source)

try:
return recognizer.recognize_sphinx(audio)
# or: return recognizer.recognize_google(audio)
except speech_recognition.UnknownValueError:
print("Could not understand audio")
except speech_recognition.RequestError as e:
print("Recog Error; {0}".format(e))

return ""

eil=raw_input("type here:-")
speak(eil)
speak("i heard you say"+listen())

Step 4: POST- Coding Part:-

after having this in your python editor or text editor , save it as filename.py
and make sure to put a microphone on , to interact or atleast input command to program

after executing the program , you will be prompted to type here :-.. go on and write what you want to hear from your machine and then speak ... enjoy

am working on the same project and developing it with aiml (artificial intelligence markup language ) by using pyaiml to give response to human and be intelligent talker..

thanks guys !! do enjoy coding and hacking

Our Best Hacking & Security Guides

New Null Byte posts — delivered straight to your inbox.

4 Responses

Why don't you show the command to get "Speech Recognizer," which is pip install speechrecognition

Package will install but not work properly on iOS, because PyAudio cannot be installed. If anyone knows how to do this, please let me know.

Does it shows: "error: command errored out with exit status 1: python setup.py egg_info check the logs for full command output. port audio"?

i wasted my 8-10 days almost over this error. @Ralph mate please let me know if you find any solution.

This problem arises because you are not having setup to download PyAudio. During installation of pip this problem arised. So solution is to get that setup. So, for that follow following steps:

step1 : to know the version of your pip installed write 'python' on your command prompt or windows powershell and then it will show the output which shows the version.

step2 : Go to this link lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

step3 : now check your processor if it is intel then select win32 in the link of step2
(like PyAudio-0.2.11-cp37-cp37m-win32.whl)

and if your processor is Ryzen then select amd one ( like like PyAudio-0.2.11-cp37-cp37m-win_amd64.whl) and click on any of the above and then you will be directed to a webpage and then something will be downloaded

and then open command prompt and change the directory to downloads and then write pip install link. NOTICE : in place of link you have to open downloads and write first three letters of the wheel file that you have just downloaded and then press tab.

I also encountered this error and hope that it will help you.

That is great !
let me explain "The SOURCE CODE " .
I want to know more about it.
Also i am agree with this - " Package will install but not work properly on iOS ".
So kindly explain the both things..

Share Your Thoughts

  • Hot
  • Active