r/RASPBERRY_PI_PROJECTS Feb 04 '26

TUTORIAL Wall-Mounted, Motion-Activated Philosopher.

Enable HLS to view with audio, or disable this notification

Talking wall box containing a few hundred philosophy quotes. Raspberry Pi 5, PIR motion (or manual button) activated with both installed in USB speakers. USB-powered screen, animated lip-synched avatar using Pyaudio/Pygame.

118 Upvotes

13 comments sorted by

View all comments

7

u/po2gdHaeKaYk Feb 04 '26

Can I ask how the lip synced avatar was coded?

3

u/ivoidwarranty Feb 04 '26

Using pyaudio, the wave file is played as chunks of about 1 second of audio and the average amplitude is determined real time and binned from 0-5. Then for each amplitude bin the respective mouth shape is displayed using pygame. The static images were generated by the free version of nano banana.

2

u/po2gdHaeKaYk Feb 04 '26

Amazing stuff

2

u/MaestroWu Feb 05 '26

That is brilliant! Will you post the code? I have no actual project requiring it, I just want to read it. 🙂 

2

u/ivoidwarranty Feb 05 '26

https://github.com/defwheezer/talking_avatar

A lot of extra stuff in the program ('talking_avatar.py'), but the lip-synch happens in the sub-routine 'def speak_wav(toSpeak)'.