Files
ComfyUI-Omnivoice/nodes/voice_design.py
T
Ethanfel 194e0b0e09 fix: trim accent list to model-validated values only
The model's _resolve_instruct() validates against a fixed vocabulary.
Only 10 accents are supported — removed all unsupported additions.
Updated tooltip to reflect actual constraints.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 20:17:59 +02:00

46 lines
1.6 KiB
Python

class OmniVoiceVoiceDesign:
"""Compose a voice design instruct string from structured dropdowns."""
GENDERS = ["none", "male", "female"]
AGES = ["none", "child", "teenager", "young adult", "middle-aged", "elderly"]
PITCHES = [
"none",
"very low pitch", "low pitch", "moderate pitch",
"high pitch", "very high pitch", "whisper",
]
# Exactly the accents validated by the model's _resolve_instruct()
ACCENTS = [
"none",
"american accent", "australian accent", "british accent",
"canadian accent", "chinese accent", "indian accent",
"japanese accent", "korean accent", "portuguese accent",
"russian accent",
]
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"gender": (cls.GENDERS, {"default": "female",
"tooltip": "Voice gender."}),
"age": (cls.AGES, {"default": "none",
"tooltip": "Approximate age of the speaker."}),
"pitch": (cls.PITCHES, {"default": "none",
"tooltip": "Pitch / register of the voice."}),
"accent": (cls.ACCENTS, {"default": "none",
"tooltip": "Accent validated by the model. Only these 10 are supported."}),
},
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("instruct",)
FUNCTION = "compose"
CATEGORY = "OmniVoice"
def compose(self, gender, age, pitch, accent):
parts = [v for v in [gender, age, pitch, accent] if v != "none"]
return (", ".join(parts),)