Yandex Speech
Kit TTS integration for speech synthesis. Yandex SpeechKit TTS is the best choice for Russian-language products: natural pronunciation, correct stress, and an understanding of Russian realities. Voices: Alena, Filipp, Jane, Omazh, Zahar, and others. Infrastructure in the Russian Federation. ### Synthesis via REST API```python import requests
def synthesize(text: str, voice: str = "alena", speed: float = 1.0) -> bytes: """Синтез через Yandex SpeechKit""" response = requests.post( "https://tts.api.cloud.yandex.net/speech/v1/tts:synthesize", headers={"Authorization": f"Api-Key {YANDEX_API_KEY}"}, data={ "text": text, "lang": "ru-RU", "voice": voice, "speed": str(speed), "format": "oggopus", # oggopus | lpcm | mp3 "sampleRateHertz": "48000", "folderId": YANDEX_FOLDER_ID, } ) response.raise_for_status() return response.content
Доступные голоса
VOICES = {
"female": ["alena", "jane", "omazh", "oksana"],
"male": ["filipp", "zahar", "ermil"],
"premium": ["alena:premium", "filipp:premium"] # наилучшее качество
}
### Speech control optionspython
data = {
"text": text,
"speed": "0.8", # 0.1–3.0 (норма = 1.0)
"emotion": "good", # good | evil | neutral (зависит от голоса)
"voice": "alena",
"format": "lpcm", # для телефонии
"sampleRateHertz": "8000", # 8000 | 16000 | 48000
}
### SSML support (v3 API)python
REST v3 для SSML и расширенного управления
headers = {
"Authorization": f"Bearer {IAM_TOKEN}",
"x-folder-id": FOLDER_ID
}
body = {
"utteranceSynthesisRequest": {
"text": "







