-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_full_dialogue_lipsync.py
More file actions
65 lines (51 loc) · 2.17 KB
/
test_full_dialogue_lipsync.py
File metadata and controls
65 lines (51 loc) · 2.17 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
56
57
58
59
60
61
62
63
64
65
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_full_dialogue_test():
print("🎭 FULL DIALOGUE LIP-SYNC TEST - Anya's Monologue 🎭")
print("=" * 60)
# 1. Setup Anya's Voice Profile
profile = VoiceProfile(
gender=Gender.FEMININE,
pitch_offset=2.5,
intonation=VoiceIntonation.EMOTIONAL,
kitten_voice_id="natural_1"
)
# 2. The Dialogue script
dialogue = [
"Welcome to the StoryCore Engine production suite.",
"I am Anya, and today we are testing the full synchronization between my voice and my 3D mesh.",
"It is a complex process, but it allows for unprecedented character consistency.",
"Now, let's look at the generated viseme data for Blender."
]
full_text = " ".join(dialogue)
# 3. Initialize Generator
generator = VoicePreviewGenerator()
print(f"Processing dialogue ({len(dialogue)} sentences)...")
# 4. Generate Visemes for the whole dialogue
visemes = await generator.generate_visemes(full_text, profile)
# 5. Export for Blender
output_path = "exports/anya_full_monologue_lipsync.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✓ Full dialogue processed: {len(visemes)} viseme keyframes generated.")
print(f"✓ Total duration estimate: {visemes[-1]['timestamp'] + 0.5:.2f} seconds.")
print(f"✓ Saved to: {output_path}")
print("\n[Blender Pipeline Preview]")
print(f" 1. In Blender, select 'Anya' mesh.")
print(f" 2. Run 'src/three_d/blender_lipsync_animator.py'.")
print(f" 3. Open '{output_path}'.")
print(f" 4. Watch Anya speak her monologue at 24 FPS.")
print("\n🏆 DIALOGUE TEST SUCCESSFUL.")
if __name__ == "__main__":
asyncio.run(run_full_dialogue_test())