Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions wyoming_cloud_streamer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,21 @@ async def main() -> None:
_LOGGER.debug(args)


# Voice list
# Default voices are loaded from voices.json.
# For OpenAI(-compatible) endpoints that support custom voices but don't expose discovery,
# you can override the advertised OpenAI voices via env var:
# OPENAI_TTS_VOICES=Will_Default,will
with open("/app/wyoming_cloud_streamer/voices.json", "r", encoding="utf-8") as f:
voices_data = json.load(f)

override_openai_voices = os.getenv("OPENAI_TTS_VOICES", "").strip()
if override_openai_voices:
voices_data.setdefault("openai", {}).setdefault("voices", [])
voices_data["openai"]["voices"] = [
v.strip() for v in override_openai_voices.split(",") if v.strip()
]

voices = []
for key in voices_data.keys():
for voice in voices_data[key]["voices"]:
Expand Down
5 changes: 4 additions & 1 deletion wyoming_cloud_streamer/engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ def _parse_voice(self, voice_name: str) -> str:
async def stream(
self, text: str, voice_name: str, cli_args
) -> AsyncGenerator[Tuple[str, object], None]:
client = OpenAI()
base_url = os.getenv("OPENAI_BASE_URL")
# Allow using a local OpenAI-compatible endpoint (e.g., MOSS-TTS) by setting OPENAI_BASE_URL.
# Example: OPENAI_BASE_URL=http://127.0.0.1:8880/v1
client = OpenAI(base_url=base_url) if base_url else OpenAI()
voice = self._parse_voice(voice_name)

# Resolve model precedence: ENV > default
Expand Down