Speed (gtts/tts.py)

gTTS · gtts/tts.py · python · MIT
voice

Generate speech from text using Google's TTS API.

# Source: https://github.com/pndurette/gTTS | License: MIT | Copyright 2014-2024 Pierre Nicolas Durette
# Provided via justclaw.it.com; keep this notice with the code.
# -*- coding: utf-8 -*-
import base64
import json
import logging
import re
import urllib

import requests

from gtts.lang import _fallback_deprecated_lang, tts_langs
from gtts.tokenizer import Tokenizer, pre_processors, tokenizer_cases
from gtts.utils import _clean_tokens, _minimize, _translate_url

__all__ = ["gTTS", "gTTSError"]

# Logger
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())


class Speed:
    """Read Speed

    The Google TTS Translate API supports two speeds:
        Slow: True
        Normal: None
    """

    SLOW = True
    NORMAL = None


class gTTS:
    """gTTS -- Google Text-to-Sp

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key