Mouth
John O'Laughlin


 

My program takes as its input a 22Khz 8 bit unsigned raw sound file.  For each block of samples (where there are 90 blocks per second) it determines both the minimum and maximum sample.  "Volume" is said to be max(abs(min), abs(max)).  Then the volumes are cropped by two thresholds, one for "fully open", and one for "half open".  The result of this pass is essentially a step function.  Short "blips" are then removed, since they are likely the result of background noise or popping consonants.  To create smooth, natural looking motion, the function is then filtered linearly three times.  We can then save the output which is a text file consisting of an integer for each frame (30 per second).  To load
it into Maya I used a .mel script like this:

$fileId=`fopen "U:/cs838/proj1/retry/Mouth/Debug/test.out" "r"`;
string $nextLine = `fgetline $fileId`;
int $i = 0;
while ( size( $nextLine ) > 0 ) {
       int $j = $nextLine;
       setKeyframe -at scaleX -t $i -v $j Mouth;
        $nextLine = `fgetline $fileId`;
       $i = $i + 1;
   }
fclose $fileId;

In the animation the Mouth data was used to control the envelope of a sculpt deformer.

executable
source (requires fltk)
ride along dialogue as raw sound file
sample output of Mouth