-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo_lipsync_production.py
More file actions
55 lines (42 loc) · 1.64 KB
/
demo_lipsync_production.py
File metadata and controls
55 lines (42 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import asyncio
import os
import json
import sys
from pathlib import Path
# Add src to path
sys.path.append(os.getcwd())
from src.models.character_ccd import (
CharacterCoreData, VisualProfile, NarrativeProfile, VoiceProfile,
ArtStyle, CreationMethod, Gender, VoiceIntonation
)
from src.tts.voice_preview_generator import VoicePreviewGenerator
async def run_lipsync_demo():
print("👄 STORYCORE LIP-SYNC PRODUCTION DEMO 👄")
print("=" * 60)
# 1. Setup Character with Voice
profile = VoiceProfile(
gender=Gender.FEMININE,
pitch_offset=2.5,
intonation=VoiceIntonation.EMOTIONAL
)
# 2. Initialize Generator
generator = VoicePreviewGenerator()
script = "Hello Blender, I am Anya. I can talk now!"
print(f"Generating visemes for: '{script}'")
# 3. Generate Viseme Data
visemes = await generator.generate_visemes(script, profile)
# 4. Save to JSON for Blender
output_path = "exports/anya_lipsync_data.json"
os.makedirs("exports", exist_ok=True)
with open(output_path, "w", encoding='utf-8') as f:
json.dump(visemes, f, indent=2)
print(f"\n✓ Viseme data generated ({len(visemes)} entries).")
print(f"✓ File saved to: {output_path}")
print(f"✓ Ready for Blender script: src/three_d/blender_lipsync_animator.py")
# Print sample
print("\nSample Visemes:")
for v in visemes[:5]:
print(f" Time: {v['timestamp']:.2f}s -> Viseme: {v['viseme']}")
print("\n🏆 PRODUCTION READY: Feed this JSON into Blender for instant animation.")
if __name__ == "__main__":
asyncio.run(run_lipsync_demo())