Close

First iteration: Jasper

A project log for Animated Computer interface

Why talk to a speaker when you can interact with, say, a cat?

marc-a-belangerMarc A. Belanger 03/28/2018 at 00:030 Comments

As a first step, I set up Jasper on a clean Raspbian install, on a Raspberry Pi, with a few modules. The idea was to see that it all worked, before trying to add the visuals.

Since it was only a proof of concept, I downloaded some animated GIF of a cat and extracted the images and divided it in two parts: the cat moving around, and the cat talking. To animate, I decided to go with Pygame; it's fairly straightforward, and easy to set up, you can see the code in the file, catalk.py.

Next step was to insert the animation into the system. The way Jasper works is:

My intervention was between the last two, in this fashion: create and start a thread

isTalking = threading.Thread(target=os.system, args=('mpg123 -q {}response.mp3'.format(path),))    	isTalking.start()

Animate the cat while the sound is playing

while isTalking.isAlive():
    	catalk.talkingcat()

That's it! All in all, at that point, it wasn't too difficult (for someone not too used to Python).

Next, we assemble it into a magic mirror.

Discussions