Skip to main content

Python client library for Talkscriber Live Transcription and Text-to-Speech services

Project description

TSClient - Talkscriber Python Client

PyPI version Python Support License: MIT Downloads GitHub stars

A comprehensive Python client library for Talkscriber's Live Transcription and Text-to-Speech services. This package provides easy-to-use APIs for real-time speech-to-text transcription and ultra-low latency text-to-speech conversion.

Features

Live Transcription

  • Real-time speech-to-text transcription via WebSocket
  • Support for 200+ languages
  • Smart turn detection using ML models
  • Translation capabilities
  • File and microphone input support

Text-to-Speech

  • Ultra-low latency streaming (speech starts in <0.1 seconds)
  • Real-time audio playback
  • Multiple voice options
  • Audio file saving
  • Configurable buffering for optimal performance

Installation

Quick Install

pip install tsclient

System Dependencies

The package requires some system-level dependencies for audio processing:

macOS:

# Install PortAudio (required for PyAudio)
brew install portaudio

# Then install the package
pip install tsclient

Ubuntu/Debian:

# Install system dependencies
sudo apt-get update
sudo apt-get install libasound2-dev portaudio19-dev python3-dev

# Then install the package
pip install tsclient

Windows:

# No additional setup required - just install the package
pip install tsclient

CentOS/RHEL/Fedora:

# Install system dependencies
sudo yum install portaudio-devel python3-devel
# or for newer versions:
sudo dnf install portaudio-devel python3-devel

# Then install the package
pip install tsclient

Development Install

For development or to run examples:

git clone https://github.com/Talkscriber/ts-client.git
cd ts-client
pip install -e .

Quick Start

Get Your API Key

  1. Visit Talkscriber Dashboard
  2. Sign up or log in
  3. Generate an API key
  4. Set it as an environment variable:
export TALKSCRIBER_API_KEY="your_api_key_here"

Live Transcription

from talkscriber.stt import TranscriptionClient

# Initialize client
client = TranscriptionClient(
    host="wss://api.talkscriber.com",
    port=9090,
    api_key="your_api_key",
    language="en"
)

# Start live transcription from microphone
client()

# Or transcribe from file
client("audio_file.wav")

Text-to-Speech

from talkscriber.tts import TalkScriberTTSClient

# Initialize TTS client
tts_client = TalkScriberTTSClient(
    api_key="your_api_key",
    text="Hello, world!",
    speaker_name="tara"
)

# Generate and play speech
tts_client.run_simple_test()

Command Line Interface

The package includes convenient CLI tools:

Live Transcription CLI

# Transcribe from microphone
talkscriber-stt --api-key YOUR_KEY --language en

# Transcribe from file
talkscriber-stt --api-key YOUR_KEY --file audio.wav

# Enable multilingual detection
talkscriber-stt --api-key YOUR_KEY --multilingual

Text-to-Speech CLI

# Basic TTS
talkscriber-tts --api-key YOUR_KEY --text "Hello, world!"

# Save to file
talkscriber-tts --api-key YOUR_KEY --text "Hello" --save output.wav

# Use specific voice
talkscriber-tts --api-key YOUR_KEY --text "Hello" --speaker tara

API Reference

Live Transcription

TranscriptionClient

TranscriptionClient(
    host: str,
    port: int,
    api_key: str,
    multilingual: bool = False,
    language: str = None,
    translate: bool = False,
    enable_turn_detection: bool = False,
    turn_detection_timeout: float = 0.6
)

Parameters:

  • host: WebSocket host URL
  • port: WebSocket port number
  • api_key: Your Talkscriber API key
  • multilingual: Enable auto language detection
  • language: Language code (e.g., "en", "es", "fr")
  • translate: Enable translation
  • enable_turn_detection: Enable ML-based turn detection
  • turn_detection_timeout: Timeout for turn detection

Text-to-Speech

TalkScriberTTSClient

TalkScriberTTSClient(
    host: str = "api.talkscriber.com",
    port: int = 9099,
    text: str,
    speaker_name: str = "tara",
    api_key: str,
    enable_playback: bool = True,
    save_audio_path: str = None
)

Parameters:

  • host: TTS server hostname
  • port: TTS server port
  • text: Text to convert to speech
  • speaker_name: Voice to use
  • api_key: Your Talkscriber API key
  • enable_playback: Enable real-time audio playback
  • save_audio_path: Optional path to save audio file

Supported Languages

The client supports 200+ languages including English, Spanish, French, German, Chinese, Japanese, and many more. See the full language list in our documentation.

Examples

Check out the examples/ directory for comprehensive examples organized by category:

Quick Start

# First, install the package
pip install tsclient

# Then run examples
# Interactive demo (recommended for beginners)
python examples/integration/comprehensive_demo.py

# Basic STT (microphone)
python examples/stt/basic.py

# Basic TTS (text-to-speech)
python examples/tts/basic.py

Example Categories

Speech-to-Text (STT):

  • stt/basic.py - Real-time microphone transcription
  • stt/file.py - Transcribe audio files
  • stt/multilingual.py - Automatic language detection

Text-to-Speech (TTS):

  • tts/basic.py - Basic TTS with real-time playback
  • tts/save_file.py - Generate and save audio files
  • tts/silent.py - Silent TTS generation
  • tts/different_voices.py - Multiple voice comparison
  • tts/batch.py - Batch processing from text files

Integration:

  • integration/stt_to_tts.py - Complete voice processing pipeline
  • integration/comprehensive_demo.py - Interactive demo

Configuration:

  • configuration/config_patterns.py - Configuration patterns and best practices

See the examples README for detailed usage instructions and the complete directory structure.

Documentation

Links

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

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

tsclient-1.0.0.tar.gz (179.0 kB view details)

Uploaded Source

Built Distribution

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

tsclient-1.0.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file tsclient-1.0.0.tar.gz.

File metadata

  • Download URL: tsclient-1.0.0.tar.gz
  • Upload date:
  • Size: 179.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.19

File hashes

Hashes for tsclient-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a607c102c08fce4b8b93ca8e3499666936383704126fbb720eb89615a4aa40a0
MD5 6731f322a7ce5f0887257df65a67c8cb
BLAKE2b-256 1c43a74b356c1f4f93326e3bbf8c3794314806ed451fc8103a015d0595932460

See more details on using hashes here.

File details

Details for the file tsclient-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tsclient-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.19

File hashes

Hashes for tsclient-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcf3905f3668742ec8aedde73c52997ea53ef46861878274c2ec7d2a9710dffc
MD5 ec714152a307f74b3d48ccbd79a26312
BLAKE2b-256 c8b7c32d0432cc9bc3301911243fe41166db4f7dcda0a6882200d093a29acf5f

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