fix: clamp ElevenLabs speed and adjust russian phrasing

This commit is contained in:
Konturai DevOps
2026-04-30 03:03:22 +05:00
parent b75e36dd1a
commit 25f75ae405
2 changed files with 14 additions and 2 deletions
+13 -1
View File
@@ -53,6 +53,18 @@ def _parse_chunk_schedule(raw: str | None) -> list[int]:
return values or [80, 120, 160, 220]
def _max_min(value: float, low: float, high: float) -> float:
try:
v = float(value)
except Exception:
v = low
if v < low:
return low
if v > high:
return high
return v
def _sample_rate_from_pcm_format(output_format: str) -> int | None:
normalized = str(output_format or "").strip().lower()
if not normalized.startswith("pcm_"):
@@ -131,7 +143,7 @@ class ElevenLabsTTS(BaseTTS):
self._voice_settings = {
"stability": self._read_float_env("ELEVENLABS_TTS_STABILITY", 0.5),
"similarity_boost": self._read_float_env("ELEVENLABS_TTS_SIMILARITY_BOOST", 0.75),
"speed": self._read_float_env("ELEVENLABS_TTS_SPEED", 1.15),
_max_min(self._read_float_env("ELEVENLABS_TTS_SPEED", 1.15), 0.7, 1.2),
"use_speaker_boost": self._read_bool_env("ELEVENLABS_TTS_USE_SPEAKER_BOOST", True),
}
LOGGER.info(