Blender Mouth Animation
Ideas and goals to embed mouth movement in blender.
Blender Mouth Animation
Alphabet Voice Analysis FFT
The Idea:
Generate a text sequence from a audio file, after FFT analysis.
The speach frequencys are matched to phoneme's,
which can be seen as a kind of facial expression,
which are shown during formulating words by mouth.
In Blender this facial expressions can be formulated in shape keys.
Shape keys are kind of variations of a meshes vertex locations,
this propertis are located in "Object Data propertis" below "Vertex Groups".
In three JS the equivalent to shape keys seems to be "morph target",
this can be adjusted like MESH.morphTargetInfluences[n] = 0...1;
Open and analyze Audio File with Python, using librosa library.
Blender:
Thanks to Christian j Mills for his documentation about this blender python API aspect.
Get Array of ShapeKey Names:
bpy.context.selected_objects[0].data.shape_keys.key_blocks.keys()
bpy.data.objects['Cube'].data.shape_keys.key_blocks.keys()
Add a ShapeKey Keyframe:
bpy.data.objects['Cube'].data.shape_keys.key_blocks[2].value=0.5
bpy.data.objects['Cube'].data.shape_keys.key_blocks[2].keyframe_insert(data_path='value',frame=40)
Example Function from C.J.Mills to set multiple keyframes:
def add_keyframe_sequence(obj, attribute, values, frames):
""" Add a sequence of keyframes for an object"""
for v, f in zip(values, frames):
setattr(obj, attribute, v)
obj.keyframe_insert(data_path=attribute, frame=f)
Alphabet Data Extraction with python: