Speech Synthesis with Voice and Timbre Selection Implementation

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1 servicesAll 1566 services
Speech Synthesis with Voice and Timbre Selection Implementation
Simple
from 1 business day to 3 business days
FAQ
AI Development Areas
AI Solution Development Stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_logo-advance_0.png
    B2B Advance company logo design
    561
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823
  • image_logo-aider_0.jpg
    AIDER company logo development
    762
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    848

Speech synthesis implementation with voice and timbre selection. Voice and timbre selection is the user interface over the TTS system. Different voices for different contexts: official for banking, friendly for retail, neutral for IVR. ### Voice catalog and mapping

from dataclasses import dataclass
from enum import Enum

class VoiceGender(Enum):
    MALE = "male"
    FEMALE = "female"

@dataclass
class VoiceProfile:
    id: str
    name: str
    gender: VoiceGender
    language: str
    provider: str
    style: str  # formal | friendly | neutral | energetic
    sample_url: str

VOICE_CATALOG = [
    VoiceProfile("alena", "Алёна", VoiceGender.FEMALE, "ru", "yandex",
                 "friendly", "/samples/alena.mp3"),
    VoiceProfile("filipp", "Филипп", VoiceGender.MALE, "ru", "yandex",
                 "neutral", "/samples/filipp.mp3"),
    VoiceProfile("sv-svetlana", "Светлана", VoiceGender.FEMALE, "ru", "azure",
                 "formal", "/samples/svetlana.mp3"),
    VoiceProfile("alloy", "Alloy", VoiceGender.MALE, "en", "openai",
                 "neutral", "/samples/alloy.mp3"),
]

def select_voice(gender: VoiceGender, language: str,
                 style: str = "neutral") -> VoiceProfile:
    candidates = [v for v in VOICE_CATALOG
                  if v.gender == gender and v.language == language
                  and v.style == style]
    return candidates[0] if candidates else VOICE_CATALOG[0]
```### Timbre parameters (prosody)```python
@dataclass
class VoiceSettings:
    rate: float = 1.0      # скорость: 0.5–2.0
    pitch: float = 0.0     # тональность: -20 до +20 полутонов
    volume: float = 1.0    # громкость: 0.0–2.0

def apply_voice_settings(text: str, settings: VoiceSettings) -> str:
    """Оборачиваем текст в SSML с параметрами тембра"""
    rate_map = {0.5: "x-slow", 0.75: "slow", 1.0: "medium",
                1.25: "fast", 1.5: "x-fast"}
    rate_str = f"{int(settings.rate * 100)}%"
    pitch_str = f"{settings.pitch:+.0f}st"

    return f"""<speak>
  <prosody rate="{rate_str}" pitch="{pitch_str}">
    {text}
  </prosody>
</speak>"""
```### Voice A/B Testing To optimize your voice brand based on satisfaction metrics:```python
import random

def get_voice_for_user(user_id: str, test_name: str) -> str:
    # Детерминированное распределение по user_id
    hash_val = hash(f"{user_id}:{test_name}") % 100
    if hash_val < 50:
        return "alena"  # control
    else:
        return "filipp"  # variant
```Timeframe: Votes catalog with selection UI – 2–3 days. Full system with A/B and analytics – 1 week.