Talking and Listening with Python

 I note some details about getting Python 3 to talk and listen, and read and write (Exif data)

Setup

>py -v

Python 3.5.2

>>> platform.architecture()
('64bit', 'WindowsPE')

Listen

>pip install SpeechRecognition

>pip install PyAudio # If you need a microphone

Read and Write Exif

Install pywin32 with an installer. Be careful to get the right 64/32bit to match you Python (not your hardware). See “setup”.

>easy_install piexif

>easy_install Pillow

def writeExif(filename,comment):
im = Image.open(filename)
exif_dict = piexif.load(im.info["exif"])
#exif_dict["0th"][piexif.ImageIFD.ImageDescription] = u"THIS IS THE DESC"
exif_dict["Exif"][piexif.ExifIFD.UserComment] = comment
exif_bytes = piexif.dump(exif_dict)
im.save("talkie.jpg", "jpeg", exif=exif_bytes)

Speak

Install git for windows

>pip install git+https://github.com/jpercent/pyttsx.git      # Python3 version of pyttsx

Leave a Reply

Your email address will not be published. Required fields are marked *