Giter Site home page Giter Site logo

pwface's Introduction

Pygame Mouth Animation

This script uses the Pygame library to animate the mouth of an image depending on the loudness of sound from the microphone.

Prerequisites

  • Pygame
  • Pyaudio
  • win32api
  • win32con
  • win32gui

Usage

  1. Run the script
  2. Speak into the microphone
  3. Observe the animation of the mouth on the window
  4. Press Escape to exit the animation

Code explanation

  • The script first initializes the Pygame window and sets it to a borderless window of size (700, 450)
  • It then gets the handle of the current active window and sets it to be layered with a transparent background
  • The script loads the images of the character, the open mouth, and the closed mouth
  • In the main animation loop, the script checks the loudness of the sound and updates the animation accordingly
  • The script also checks for the escape key being pressed to exit the animation
  • The animation window is updated continuously

You can change the loudness threshold and the images path to your preference.

Conclusion

This script demonstrates how to use Pygame to create a simple animation in response to sound input. It can be used as a starting point for more complex animations or interactive projects.

pwface's People

Contributors

asdcxfrt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

baton332

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.