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
+1 -1
View File
@@ -38,7 +38,7 @@ ELEVENLABS_TTS_VOICE_ID=
ELEVENLABS_TTS_MODEL_ID=eleven_flash_v2_5
ELEVENLABS_TTS_LANGUAGE_CODE=ru
ELEVENLABS_TTS_OUTPUT_FORMAT=pcm_16000
ELEVENLABS_TTS_SPEED=1.35
ELEVENLABS_TTS_SPEED=1.2
ELEVENLABS_STT_MODEL_ID=scribe_v2
ELEVENLABS_STT_REALTIME_MODEL_ID=scribe_v2_realtime
ELEVENLABS_STT_LANGUAGE_CODE=ru
+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(