Skip to main content

A simple text to speech program using edge-tts library

Project description

TTS_ka ๐Ÿš€ Ultra-Fast Text-to-Speech

Ultra-Fast Text-to-Speech CLI tool with maximum speed generation, smart chunking, and parallel processing. Converts text to high-quality speech in Georgian (๐Ÿ‡ฌ๐Ÿ‡ช), Russian (๐Ÿ‡ท๐Ÿ‡บ), and English (๐Ÿ‡ฌ๐Ÿ‡ง) languages.

Python 3.6+ MIT License

โœจ Features

  • ๐Ÿš€ Ultra-Fast Generation: 6-15 seconds for 1000 words (vs 25+ seconds traditional)
  • ๐Ÿง  Smart Chunking: Automatic text splitting for optimal performance
  • โšก Parallel Processing: Multi-threaded generation with up to 8 workers
  • ๐Ÿ“‹ Clipboard Integration: Direct clipboard-to-speech workflow
  • ๐ŸŽฏ Auto-Optimization: Turbo mode automatically optimizes all settings
  • ๐ŸŽต High-Quality Voices: Premium neural voices for all languages
  • ๐Ÿ“ File Support: Process text files directly
  • ๐Ÿ”„ Real-time Playback: Automatic audio playback with system player

๐ŸŽฏ Quick Start

1. Installation

# Install from PyPI (recommended)
pip install TTS_ka

# Or install from source
git clone https://github.com/DavidTbilisi/TTS.git
cd TTS
pip install -e .

2. Basic Usage (RECOMMENDED)

# Ultra-fast generation with auto-optimization (RECOMMENDED)
python -m TTS_ka "Hello, how are you today?" --turbo --lang en

# Georgian text with maximum speed
python -m TTS_ka "แƒ’แƒแƒ›แƒแƒ แƒฏแƒแƒ‘แƒ, แƒ แƒแƒ’แƒแƒ  แƒฎแƒแƒ แƒ—?" --turbo --lang ka

# Russian text with turbo mode
python -m TTS_ka "ะŸั€ะธะฒะตั‚, ะบะฐะบ ะดะตะปะฐ?" --turbo --lang ru

3. Clipboard Workflow (FASTEST)

# Copy any text, then run (fastest workflow):
python -m TTS_ka clipboard --turbo --lang en

# For different languages:
python -m TTS_ka clipboard --turbo --lang ka  # Georgian
python -m TTS_ka clipboard --turbo --lang ru  # Russian

4. File Processing

# Process text files directly
python -m TTS_ka document.txt --turbo --lang en

# Long files with custom settings
python -m TTS_ka large_file.txt --turbo --chunk-seconds 30 --parallel 6 --lang ru

๐Ÿ“– Complete Usage Guide

Command Syntax

python -m TTS_ka [TEXT_SOURCE] [OPTIONS]

Text Sources

  • Direct text: "Your text here"
  • Clipboard: clipboard (copy text first)
  • File path: file.txt, document.md, etc.

Essential Options

Option Description Examples
--turbo ๐Ÿš€ RECOMMENDED: Maximum speed with auto-optimization --turbo
--lang Language: ka (Georgian), ru (Russian), en (English) --lang ka
--chunk-seconds Chunk size in seconds (0=auto, 20-60 optimal) --chunk-seconds 30
--parallel Workers (0=auto, 2-8 recommended) --parallel 6
--no-play Skip automatic audio playback --no-play
--help-full Show comprehensive help with examples --help-full

๐Ÿƒโ€โ™‚๏ธ Performance Examples

Speed Comparison (1000 words)

  • Traditional TTS: 25-40 seconds
  • TTS_ka Direct: 15-25 seconds
  • TTS_ka Turbo: 8-15 seconds
  • TTS_ka Chunked: 6-12 seconds โšก

Real-World Examples

# 1. Quick phrases (instant generation)
python -m TTS_ka "Thank you very much!" --turbo --lang en
# โšก Completed in 2.3s

# 2. Medium text (paragraph)
python -m TTS_ka "Lorem ipsum dolor sit amet..." --turbo --lang en  
# โšก Completed in 5.7s (direct)

# 3. Long document (chunked processing)
python -m TTS_ka large_document.txt --turbo --lang en
# Strategy: chunked generation, 6 workers
# โšก Completed in 12.4s (chunked)

# 4. Clipboard workflow (daily usage)
python -m TTS_ka clipboard --turbo --lang ka
# TURBO MODE ENGAGED - Georgian
# Processing: 45 words, 287 characters
# โšก Completed in 4.1s

๐ŸŒ Language Support

Language Code Voice Quality Speed Example
Georgian ๐Ÿ‡ฌ๐Ÿ‡ช ka Premium Neural Fast --lang ka
Russian ๐Ÿ‡ท๐Ÿ‡บ ru High Quality Very Fast --lang ru
English ๐Ÿ‡ฌ๐Ÿ‡ง en Premium Neural Maximum --lang en

Voice Details

  • Georgian: ka-GE-EkaNeural - Premium female voice
  • Russian: ru-RU-SvetlanaNeural - High-quality female voice
  • English: en-GB-SoniaNeural - British English neural voice

โš™๏ธ Advanced Usage

Custom Optimization

# Manual chunking for very long texts
python -m TTS_ka book_chapter.txt --chunk-seconds 45 --parallel 4 --lang en

# Maximum parallelization (for powerful systems)
python -m TTS_ka large_text.txt --turbo --parallel 8 --lang ru

# Batch processing (no audio playback)  
python -m TTS_ka document.txt --turbo --no-play --lang ka

Workflow Integration

# Create alias for daily use
alias speak='python -m TTS_ka clipboard --turbo --lang en'

# Windows batch file (speak.bat)
@echo off
python -m TTS_ka clipboard --turbo --lang en

# Read web articles (with browser copy)
# 1. Copy article text
# 2. Run: python -m TTS_ka clipboard --turbo --lang en

๐Ÿ”ง Installation & Requirements

System Requirements

  • Python: 3.6+ (3.8+ recommended)
  • OS: Windows, macOS, Linux
  • Memory: 256MB+ available RAM
  • Network: Internet connection for voice synthesis

Dependencies

Required:

pip install edge-tts>=6.1.9        # Core TTS engine
pip install pydub>=0.25.1          # Audio processing  
pip install tqdm>=4.65.0           # Progress bars
pip install pyperclip>=1.8.2       # Clipboard support

System Requirements:

  • FFmpeg: Required for audio processing
    • Windows: Download from ffmpeg.org
    • macOS: brew install ffmpeg
    • Ubuntu: sudo apt install ffmpeg

Complete Installation

# Method 1: PyPI installation (simplest)
pip install TTS_ka

# Method 2: Development installation
git clone https://github.com/DavidTbilisi/TTS.git
cd TTS
pip install -e .

# Method 3: Manual dependencies
pip install edge-tts pydub tqdm pyperclip

# Verify installation
python -m TTS_ka "Installation successful!" --turbo --lang en

๐ŸŽฎ AutoHotkey Integration (Windows)

Quick Setup

  1. Install AutoHotkey v2
  2. Create tts_hotkeys.ahk:
; Ultra-fast TTS hotkeys
!e::  ; Alt+E - English
{
    Run("cmd /k python -m TTS_ka clipboard --turbo --lang en")
}

!r::  ; Alt+R - Russian  
{
    Run("cmd /k python -m TTS_ka clipboard --turbo --lang ru")
}

!x::  ; Alt+X - Georgian
{
    Run("cmd /k python -m TTS_ka clipboard --turbo --lang ka")
}
  1. Double-click to run, then:
    • Copy text โ†’ Alt+E for English
    • Copy text โ†’ Alt+R for Russian
    • Copy text โ†’ Alt+X for Georgian

Daily Workflow

  1. Browse web โ†’ Copy interesting text
  2. Press Alt+E โ†’ Instant speech
  3. Continue browsing while listening

๐Ÿ” Troubleshooting

Common Issues

1. "No module named 'edge_tts'"

pip install edge-tts>=6.1.9

2. "FFmpeg not found"

# Windows: Download and add to PATH
# macOS: brew install ffmpeg  
# Linux: sudo apt install ffmpeg

3. Slow generation

# Always use --turbo flag
python -m TTS_ka "text" --turbo --lang en

# Reduce parallel workers if network issues
python -m TTS_ka "text" --turbo --parallel 2 --lang en

4. Empty clipboard

# Ensure text is copied first
# Then run: python -m TTS_ka clipboard --turbo --lang en

Performance Optimization

For Maximum Speed:

# Use these exact settings for best performance
python -m TTS_ka clipboard --turbo --chunk-seconds 30 --parallel 6 --lang en

For System with Limited Resources:

# Reduce workers and chunk size
python -m TTS_ka text --turbo --parallel 2 --chunk-seconds 60 --lang en

๐Ÿ“Š Performance Benchmarks

Text Length vs Generation Time

Words Direct Mode Turbo Mode Chunked (6 workers)
10-50 2-4s 1-3s 2-4s
100-300 8-12s 5-8s 4-6s
500-1000 18-25s 12-15s 8-12s
1000+ 30-45s 18-25s 10-18s

Optimal Settings by Text Length

# Short text (< 100 words): Direct generation  
python -m TTS_ka "short text" --turbo --lang en

# Medium text (100-500 words): Turbo mode
python -m TTS_ka medium_text.txt --turbo --lang en  

# Long text (500+ words): Chunked processing
python -m TTS_ka long_text.txt --turbo --chunk-seconds 30 --parallel 6 --lang en

๐Ÿš€ Examples & Use Cases

Daily Workflows

1. Article Reading

# Copy web article โ†’ instant speech
python -m TTS_ka clipboard --turbo --lang en

2. Document Processing

# Process research papers, books, etc.
python -m TTS_ka research_paper.pdf.txt --turbo --lang en

3. Language Learning

# Practice pronunciation with different languages
python -m TTS_ka "แƒกแƒฌแƒแƒ•แƒšแƒแƒ‘แƒ“แƒ˜ แƒฅแƒแƒ แƒ—แƒฃแƒšแƒก" --turbo --lang ka
python -m TTS_ka "Learning Russian ัะทั‹ะบ" --turbo --lang ru

4. Accessibility

# Screen reader alternative
python -m TTS_ka clipboard --turbo --no-play --lang en > audio_file.mp3

Batch Processing

# Process multiple files
for file in *.txt; do
    python -m TTS_ka "$file" --turbo --no-play --lang en
done

# Windows batch processing
for %f in (*.txt) do python -m TTS_ka "%f" --turbo --no-play --lang en

๐Ÿ› ๏ธ Advanced Configuration

Environment Variables

# Set default language
export TTS_DEFAULT_LANG=ka

# Set default mode  
export TTS_DEFAULT_MODE=turbo

# Custom output directory
export TTS_OUTPUT_DIR=/path/to/audio/files

Configuration File

Create ~/.tts_config.json:

{
    "default_lang": "en",
    "turbo_mode": true,
    "chunk_seconds": 30,
    "parallel_workers": 6,
    "auto_play": true
}

๐Ÿ”Œ API Integration

Python Script Integration

#!/usr/bin/env python3
import subprocess
import sys

def text_to_speech(text, lang="en", turbo=True):
    """Convert text to speech using TTS_ka"""
    cmd = [
        "python", "-m", "TTS_ka", 
        text, 
        "--lang", lang
    ]
    if turbo:
        cmd.append("--turbo")
    
    subprocess.run(cmd)

# Usage
text_to_speech("Hello world!", "en")
text_to_speech("แƒ’แƒแƒ›แƒแƒ แƒฏแƒแƒ‘แƒ!", "ka")

Web Integration

# URL to speech (with curl + TTS_ka)
curl -s "https://example.com/article" | \
python -m TTS_ka /dev/stdin --turbo --lang en

๐Ÿ“ฑ Mobile & Remote Usage

SSH/Remote Usage

# Generate audio on remote server
ssh user@server "python -m TTS_ka 'Remote generation' --turbo --no-play"

# Download and play locally
scp user@server:data.mp3 ./remote_audio.mp3

Docker Usage

FROM python:3.9
RUN pip install TTS_ka
RUN apt-get update && apt-get install -y ffmpeg
ENTRYPOINT ["python", "-m", "TTS_ka"]
# Docker usage
docker run tts_container "Hello Docker!" --turbo --lang en

๐ŸŽฏ Tips & Best Practices

Performance Tips

  1. Always use --turbo for optimal speed
  2. Use clipboard workflow for fastest daily usage
  3. Chunk long texts with --chunk-seconds 30
  4. Optimize workers with --parallel 4-6 for most systems
  5. Pre-install FFmpeg for best audio processing

Quality Tips

  1. Georgian text: Use --lang ka for best quality
  2. Mixed languages: Process separately for optimal results
  3. Technical text: Use shorter chunks (--chunk-seconds 20)
  4. Clean input: Remove extra whitespace and formatting

Workflow Tips

  1. Create aliases for frequent commands
  2. Use hotkeys (AutoHotkey on Windows)
  3. Batch process large document collections
  4. Test settings with small text first

๐Ÿ“„ File Format Support

Supported Input Formats

  • Text files: .txt, .md, .rst
  • Code files: .py, .js, .html (extracts text)
  • Clipboard: Any copied text
  • Direct input: Command-line strings

Output Format

  • Audio: MP3 (high quality, compressed)
  • Bitrate: 128kbps (optimal size/quality balance)
  • Sample Rate: 24kHz (neural voice quality)

๐Ÿ”„ Updates & Maintenance

Keeping Updated

# Update to latest version
pip install --upgrade TTS_ka

# Check current version  
python -m TTS_ka --version

# Update dependencies
pip install --upgrade edge-tts pydub tqdm pyperclip

Health Check

# Test installation
python -m TTS_ka "System check" --turbo --lang en

# Verify FFmpeg  
ffmpeg -version

# Check Python version
python --version  # Should be 3.6+

๐Ÿค Contributing

We welcome contributions! See our GitHub repository for:

  • Bug reports and feature requests
  • Code contributions and pull requests
  • Documentation improvements
  • Language support additions

Development Setup

git clone https://github.com/DavidTbilisi/TTS.git
cd TTS
pip install -e ".[dev]"
pytest  # Run tests

๐Ÿ“ž Support

Getting Help

  1. Documentation: Use --help-full for comprehensive help
  2. Issues: Report bugs on GitHub Issues
  3. Discussions: Join GitHub Discussions

Quick Diagnostics

# Check system compatibility  
python -m TTS_ka --help-full

# Test with minimal command
python -m TTS_ka "test" --turbo --lang en

# Verify FFmpeg installation
ffmpeg -version

๐Ÿ“œ License & Credits

License: MIT License - see LICENSE file

Credits:

  • Edge-TTS: Microsoft's edge-tts library for voice synthesis
  • PyDub: Audio processing and manipulation
  • FFmpeg: Audio encoding and format conversion

Author: David Chincharashvili (davidchincharashvili@gmail.com)


โญ Star this project on GitHub if you find it useful!
๐Ÿ› Report issues to help improve the tool
๐Ÿค Contribute to make it even better

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tts_ka-1.1.0.tar.gz (47.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tts_ka-1.1.0-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file tts_ka-1.1.0.tar.gz.

File metadata

  • Download URL: tts_ka-1.1.0.tar.gz
  • Upload date:
  • Size: 47.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for tts_ka-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8a2897d6564fcb6226d6addd1d1011ba07bb6a735cd0dca20ce9017044227cf7
MD5 aa7a6f9fb8b86073e9de6035b9977400
BLAKE2b-256 8f601e19d97e74cc8dcc3e87d1b6563a3b49983521de31815de0a0d0a2d2ac52

See more details on using hashes here.

File details

Details for the file tts_ka-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: tts_ka-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for tts_ka-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a6af45fe2589e4f8d04dcb5a113e4f0655561f35a70053515fdd746b4acee1e0
MD5 5aa95fc37ffbd2bf71bcf32c2fa92fe9
BLAKE2b-256 78d9d4880b2a644d76aab278859f6dbca425d013d962bac4136110104f011ddc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page