How to trigger an animation based on realtime audio

Trying to build a face with moving lips as someone speaks realtime, any idea how to use audio as a trigger like if(mousePressed) - instead being if a threshold of amplitude is received, then perform {block of code}?


Welcome to the Processing Community! :slight_smile:

You can take a look at the Processing Sound library to manage sound (input, output, audio processing, analyse…) specially the Amplitude class :

1 Like

Thank you! I’m new to processing but it seems extremely useful. Any idea on how to incorporate OpenCV? I want my animated face to imitate the expressions made by a person in front of a camera.


I don’t think that the OpenCV library can detect eyes and facial elements but it can detect a whole face :

But a solution is to use custom cascades (which are files to detect a certain pattern) :